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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 * saveLayer() uses the texture cache. This means that the actual render tar
get may be larger | 119 * saveLayer() uses the texture cache. This means that the actual render tar
get may be larger |
120 * than the layer. Because the clip will contain the layer's bounds, no draw
s will be full-RT. | 120 * than the layer. Because the clip will contain the layer's bounds, no draw
s will be full-RT. |
121 * So when running on a GPU canvas we explicitly create a temporary canvas u
sing a texture with | 121 * So when running on a GPU canvas we explicitly create a temporary canvas u
sing a texture with |
122 * dimensions exactly matching the layer size. | 122 * dimensions exactly matching the layer size. |
123 */ | 123 */ |
124 sk_sp<SkSurface> possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int
h) { | 124 sk_sp<SkSurface> possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int
h) { |
125 #if SK_SUPPORT_GPU | 125 #if SK_SUPPORT_GPU |
126 GrContext* context = baseCanvas->getGrContext(); | 126 GrContext* context = baseCanvas->getGrContext(); |
127 SkImageInfo baseInfo = baseCanvas->imageInfo(); | 127 SkImageInfo baseInfo = baseCanvas->imageInfo(); |
128 SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInf
o.alphaType(), | 128 SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInf
o.alphaType(), |
129 sk_ref_sp(baseInfo.colorSpace())); | 129 baseInfo.profileType()); |
130 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); | 130 SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); |
131 baseCanvas->getProps(&canvasProps); | 131 baseCanvas->getProps(&canvasProps); |
132 return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &c
anvasProps); | 132 return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &c
anvasProps); |
133 #else | 133 #else |
134 return nullptr; | 134 return nullptr; |
135 #endif | 135 #endif |
136 } | 136 } |
137 | 137 |
138 void drawMode(SkCanvas* canvas, | 138 void drawMode(SkCanvas* canvas, |
139 int x, int y, int w, int h, | 139 int x, int y, int w, int h, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 sk_sp<SkShader> fBmpShader; | 221 sk_sp<SkShader> fBmpShader; |
222 | 222 |
223 typedef GM INHERITED; | 223 typedef GM INHERITED; |
224 }; | 224 }; |
225 | 225 |
226 ////////////////////////////////////////////////////////////////////////////// | 226 ////////////////////////////////////////////////////////////////////////////// |
227 | 227 |
228 DEF_GM(return new Xfermodes3GM;) | 228 DEF_GM(return new Xfermodes3GM;) |
229 | 229 |
230 } | 230 } |
OLD | NEW |