OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkImage_Base.h" | 10 #include "SkImage_Base.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 /////////////////////////////////////////////////////////////////////////////// | 37 /////////////////////////////////////////////////////////////////////////////// |
38 | 38 |
39 SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, const SkSurfaceProps*
props, | 39 SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, const SkSurfaceProps*
props, |
40 bool doClear) | 40 bool doClear) |
41 : INHERITED(renderTarget->width(), renderTarget->height(), props) { | 41 : INHERITED(renderTarget->width(), renderTarget->height(), props) { |
42 int deviceFlags = 0; | 42 int deviceFlags = 0; |
43 deviceFlags |= this->props().isUseDistanceFieldFonts() ? SkGpuDevice::kDFTex
t_Flag : 0; | 43 deviceFlags |= this->props().isUseDistanceFieldFonts() ? SkGpuDevice::kDFTex
t_Flag : 0; |
44 fDevice = SkGpuDevice::Create(renderTarget, this->props(), deviceFlags); | 44 fDevice = SkGpuDevice::Create(renderTarget, this->props(), deviceFlags); |
45 | 45 |
46 if (kRGB_565_GrPixelConfig != renderTarget->config() && doClear) { | 46 if (kRGB_565_GrPixelConfig != renderTarget->config() && doClear) { |
47 fDevice->clear(0x0); | 47 fDevice->clearAll(); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 SkSurface_Gpu::~SkSurface_Gpu() { | 51 SkSurface_Gpu::~SkSurface_Gpu() { |
52 SkSafeUnref(fDevice); | 52 SkSafeUnref(fDevice); |
53 } | 53 } |
54 | 54 |
55 SkCanvas* SkSurface_Gpu::onNewCanvas() { | 55 SkCanvas* SkSurface_Gpu::onNewCanvas() { |
56 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; | 56 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; |
57 // When we think this works... | 57 // When we think this works... |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 SkAutoTUnref<GrTexture> tex(ctx->refScratchTexture(desc, GrContext::kExact_S
cratchTexMatch)); | 156 SkAutoTUnref<GrTexture> tex(ctx->refScratchTexture(desc, GrContext::kExact_S
cratchTexMatch)); |
157 | 157 |
158 if (NULL == tex) { | 158 if (NULL == tex) { |
159 return NULL; | 159 return NULL; |
160 } | 160 } |
161 | 161 |
162 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), props, true)); | 162 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), props, true)); |
163 } | 163 } |
164 | 164 |
165 #endif | 165 #endif |
OLD | NEW |