OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 SkCanvas* tempCanvas = NULL; | 125 SkCanvas* tempCanvas = NULL; |
126 #if SK_SUPPORT_GPU | 126 #if SK_SUPPORT_GPU |
127 GrContext* context = baseCanvas->getGrContext(); | 127 GrContext* context = baseCanvas->getGrContext(); |
128 if (context) { | 128 if (context) { |
129 GrTextureDesc desc; | 129 GrTextureDesc desc; |
130 desc.fWidth = w; | 130 desc.fWidth = w; |
131 desc.fHeight = h; | 131 desc.fHeight = h; |
132 desc.fConfig = SkImageInfo2GrPixelConfig(baseCanvas->imageInfo()); | 132 desc.fConfig = SkImageInfo2GrPixelConfig(baseCanvas->imageInfo()); |
133 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 133 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
134 SkAutoTUnref<GrSurface> surface(context->createUncachedTexture(desc,
NULL, 0)); | 134 SkAutoTUnref<GrSurface> surface(context->createUncachedTexture(desc,
NULL, 0)); |
135 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(surface.get(), | 135 SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(surface.get())
); |
136 SkSurfaceProps(SkSurfaceProps::kLegacy
FontHost_InitType))); | |
137 if (device.get()) { | 136 if (device.get()) { |
138 tempCanvas = SkNEW_ARGS(SkCanvas, (device.get())); | 137 tempCanvas = SkNEW_ARGS(SkCanvas, (device.get())); |
139 } | 138 } |
140 } | 139 } |
141 #endif | 140 #endif |
142 return tempCanvas; | 141 return tempCanvas; |
143 } | 142 } |
144 | 143 |
145 void drawMode(SkCanvas* canvas, | 144 void drawMode(SkCanvas* canvas, |
146 int x, int y, int w, int h, | 145 int x, int y, int w, int h, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 SkAutoTUnref<SkShader> fBmpShader; | 237 SkAutoTUnref<SkShader> fBmpShader; |
239 | 238 |
240 typedef GM INHERITED; | 239 typedef GM INHERITED; |
241 }; | 240 }; |
242 | 241 |
243 ////////////////////////////////////////////////////////////////////////////// | 242 ////////////////////////////////////////////////////////////////////////////// |
244 | 243 |
245 DEF_GM(return new Xfermodes3GM;) | 244 DEF_GM(return new Xfermodes3GM;) |
246 | 245 |
247 } | 246 } |
OLD | NEW |