aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/xfermodes3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/xfermodes3.cpp')
-rw-r--r--gm/xfermodes3.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index 9c78658ae7..e1b1c76248 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -60,7 +60,7 @@ protected:
0x80,
};
- auto tempSurface(this->possiblyCreateTempSurface(canvas, kSize, kSize));
+ auto tempSurface(this->makeTempSurface(canvas, kSize, kSize));
int test = 0;
int x = 0, y = 0;
@@ -118,21 +118,13 @@ private:
* We are trying to test those. We could use saveLayer() to create small SkGpuDevices but
* saveLayer() uses the texture cache. This means that the actual render target may be larger
* than the layer. Because the clip will contain the layer's bounds, no draws will be full-RT.
- * So when running on a GPU canvas we explicitly create a temporary canvas using a texture with
- * dimensions exactly matching the layer size.
+ * So explicitly create a temporary canvas with dimensions exactly the layer size.
*/
- sk_sp<SkSurface> possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int h) {
-#if SK_SUPPORT_GPU
- GrContext* context = baseCanvas->getGrContext();
+ sk_sp<SkSurface> makeTempSurface(SkCanvas* baseCanvas, int w, int h) {
SkImageInfo baseInfo = baseCanvas->imageInfo();
SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInfo.alphaType(),
baseInfo.refColorSpace());
- SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
- baseCanvas->getProps(&canvasProps);
- return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &canvasProps);
-#else
- return nullptr;
-#endif
+ return baseCanvas->makeSurface(info);
}
void drawMode(SkCanvas* canvas,
@@ -146,6 +138,7 @@ private:
SkCanvas* modeCanvas;
if (nullptr == surface) {
canvas->saveLayer(&r, nullptr);
+ canvas->clipRect(r);
modeCanvas = canvas;
} else {
modeCanvas = surface->getCanvas();