Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 private: | 29 private: |
| 30 SkGpuDevice* fDevice; | 30 SkGpuDevice* fDevice; |
| 31 | 31 |
| 32 typedef SkSurface_Base INHERITED; | 32 typedef SkSurface_Base INHERITED; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 /////////////////////////////////////////////////////////////////////////////// | 35 /////////////////////////////////////////////////////////////////////////////// |
| 36 | 36 |
| 37 SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, bool cached, TextRend erMode trm, | 37 SkSurface_Gpu::SkSurface_Gpu(GrRenderTarget* renderTarget, bool cached, TextRend erMode trm, |
| 38 SkSurface::RenderTargetFlags flags) | 38 SkSurface::RenderTargetFlags flags) |
| 39 : INHERITED(renderTarget->width(), renderTarget->height()) { | 39 : INHERITED(renderTarget->width(), renderTarget->height(), Props()) |
|
robertphillips
2014/09/16 14:15:19
line above ?
| |
| 40 { | |
| 40 int deviceFlags = 0; | 41 int deviceFlags = 0; |
| 41 deviceFlags |= cached ? SkGpuDevice::kCached_Flag : 0; | 42 deviceFlags |= cached ? SkGpuDevice::kCached_Flag : 0; |
| 42 deviceFlags |= (kDistanceField_TextRenderMode == trm) ? SkGpuDevice::kDFFont s_Flag : 0; | 43 deviceFlags |= (kDistanceField_TextRenderMode == trm) ? SkGpuDevice::kDFFont s_Flag : 0; |
| 43 fDevice = SkGpuDevice::Create(renderTarget, deviceFlags); | 44 fDevice = SkGpuDevice::Create(renderTarget, deviceFlags); |
| 44 | 45 |
| 45 if (kRGB_565_GrPixelConfig != renderTarget->config() && | 46 if (kRGB_565_GrPixelConfig != renderTarget->config() && |
| 46 !(flags & kDontClear_RenderTargetFlag)) { | 47 !(flags & kDontClear_RenderTargetFlag)) { |
| 47 fDevice->clear(0x0); | 48 fDevice->clear(0x0); |
| 48 } | 49 } |
| 49 } | 50 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 desc.fSampleCnt = sampleCount; | 149 desc.fSampleCnt = sampleCount; |
| 149 | 150 |
| 150 SkAutoTUnref<GrTexture> tex(ctx->lockAndRefScratchTexture(desc, GrContext::k Exact_ScratchTexMatch)); | 151 SkAutoTUnref<GrTexture> tex(ctx->lockAndRefScratchTexture(desc, GrContext::k Exact_ScratchTexMatch)); |
| 151 | 152 |
| 152 if (NULL == tex) { | 153 if (NULL == tex) { |
| 153 return NULL; | 154 return NULL; |
| 154 } | 155 } |
| 155 | 156 |
| 156 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), true, trm, flags)); | 157 return SkNEW_ARGS(SkSurface_Gpu, (tex->asRenderTarget(), true, trm, flags)); |
| 157 } | 158 } |
| OLD | NEW |