| 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 typedef SkSurface_Base INHERITED; | 33 typedef SkSurface_Base INHERITED; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
| 37 | 37 |
| 38 SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, const SkSurfaceProps*
props, | 38 SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, const SkSurfaceProps*
props, |
| 39 bool doClear) | 39 bool doClear) |
| 40 : INHERITED(renderTarget->width(), renderTarget->height(), props) { | 40 : INHERITED(renderTarget->width(), renderTarget->height(), props) { |
| 41 int deviceFlags = 0; | 41 int deviceFlags = 0; |
| 42 deviceFlags |= this->props().isUseDistanceFieldFonts() ? SkGpuDevice::kDFTex
t_Flag : 0; | 42 deviceFlags |= this->props().isUseDistanceFieldFonts() ? SkGpuDevice::kDFFon
ts_Flag : 0; |
| 43 fDevice = SkGpuDevice::Create(renderTarget, this->props(), deviceFlags); | 43 fDevice = SkGpuDevice::Create(renderTarget, this->props(), deviceFlags); |
| 44 | 44 |
| 45 if (kRGB_565_GrPixelConfig != renderTarget->config() && doClear) { | 45 if (kRGB_565_GrPixelConfig != renderTarget->config() && doClear) { |
| 46 fDevice->clear(0x0); | 46 fDevice->clear(0x0); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 SkSurface_Gpu::~SkSurface_Gpu() { | 50 SkSurface_Gpu::~SkSurface_Gpu() { |
| 51 SkSafeUnref(fDevice); | 51 SkSafeUnref(fDevice); |
| 52 } | 52 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 SkAutoTUnref<GrTexture> tex(ctx->refScratchTexture(desc, GrContext::kExact_S
cratchTexMatch)); | 151 SkAutoTUnref<GrTexture> tex(ctx->refScratchTexture(desc, GrContext::kExact_S
cratchTexMatch)); |
| 152 | 152 |
| 153 if (NULL == tex) { | 153 if (NULL == tex) { |
| 154 return NULL; | 154 return NULL; |
| 155 } | 155 } |
| 156 | 156 |
| 157 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), props, true)); | 157 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), props, true)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 #endif | 160 #endif |
| OLD | NEW |