OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * than the layer. Because the clip will contain the layer's bounds, no draw
s will be full-RT. | 121 * than the layer. Because the clip will contain the layer's bounds, no draw
s will be full-RT. |
122 * So when running on a GPU canvas we explicitly create a temporary canvas u
sing a texture with | 122 * So when running on a GPU canvas we explicitly create a temporary canvas u
sing a texture with |
123 * dimensions exactly matching the layer size. | 123 * dimensions exactly matching the layer size. |
124 */ | 124 */ |
125 sk_sp<SkSurface> possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int
h) { | 125 sk_sp<SkSurface> possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int
h) { |
126 #if SK_SUPPORT_GPU | 126 #if SK_SUPPORT_GPU |
127 GrContext* context = baseCanvas->getGrContext(); | 127 GrContext* context = baseCanvas->getGrContext(); |
128 SkImageInfo baseInfo = baseCanvas->imageInfo(); | 128 SkImageInfo baseInfo = baseCanvas->imageInfo(); |
129 SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInf
o.alphaType(), | 129 SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInf
o.alphaType(), |
130 baseInfo.profileType()); | 130 baseInfo.profileType()); |
131 return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, nu
llptr); | 131 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); |
| 132 baseCanvas->getProps(&canvasProps); |
| 133 return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &c
anvasProps); |
132 #else | 134 #else |
133 return nullptr; | 135 return nullptr; |
134 #endif | 136 #endif |
135 } | 137 } |
136 | 138 |
137 void drawMode(SkCanvas* canvas, | 139 void drawMode(SkCanvas* canvas, |
138 int x, int y, int w, int h, | 140 int x, int y, int w, int h, |
139 const SkPaint& modePaint, SkSurface* surface) { | 141 const SkPaint& modePaint, SkSurface* surface) { |
140 canvas->save(); | 142 canvas->save(); |
141 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 143 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 sk_sp<SkShader> fBmpShader; | 222 sk_sp<SkShader> fBmpShader; |
221 | 223 |
222 typedef GM INHERITED; | 224 typedef GM INHERITED; |
223 }; | 225 }; |
224 | 226 |
225 ////////////////////////////////////////////////////////////////////////////// | 227 ////////////////////////////////////////////////////////////////////////////// |
226 | 228 |
227 DEF_GM(return new Xfermodes3GM;) | 229 DEF_GM(return new Xfermodes3GM;) |
228 | 230 |
229 } | 231 } |
OLD | NEW |