| 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_Gpu.h" | 8 #include "SkSurface_Gpu.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool SkSurface_Gpu::onGetRenderTargetHandle(GrBackendObject* obj, BackendHandleA
ccess access) { | 57 bool SkSurface_Gpu::onGetRenderTargetHandle(GrBackendObject* obj, BackendHandleA
ccess access) { |
| 58 GrRenderTarget* rt = prepare_rt_for_external_access(this, access); | 58 GrRenderTarget* rt = prepare_rt_for_external_access(this, access); |
| 59 *obj = rt->getRenderTargetHandle(); | 59 *obj = rt->getRenderTargetHandle(); |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 SkCanvas* SkSurface_Gpu::onNewCanvas() { | 63 SkCanvas* SkSurface_Gpu::onNewCanvas() { |
| 64 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; | 64 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; |
| 65 // When we think this works... | 65 flags = static_cast<SkCanvas::InitFlags>(flags | SkCanvas::kConservativeRast
erClip_InitFlag); |
| 66 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; | |
| 67 | 66 |
| 68 return new SkCanvas(fDevice, flags); | 67 return new SkCanvas(fDevice, flags); |
| 69 } | 68 } |
| 70 | 69 |
| 71 SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) { | 70 SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) { |
| 72 GrRenderTarget* rt = fDevice->accessRenderTarget(); | 71 GrRenderTarget* rt = fDevice->accessRenderTarget(); |
| 73 int sampleCount = rt->numColorSamples(); | 72 int sampleCount = rt->numColorSamples(); |
| 74 // TODO: Make caller specify this (change virtual signature of onNewSurface)
. | 73 // TODO: Make caller specify this (change virtual signature of onNewSurface)
. |
| 75 static const Budgeted kBudgeted = kNo_Budgeted; | 74 static const Budgeted kBudgeted = kNo_Budgeted; |
| 76 return SkSurface::NewRenderTarget(fDevice->context(), kBudgeted, info, sampl
eCount, | 75 return SkSurface::NewRenderTarget(fDevice->context(), kBudgeted, info, sampl
eCount, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 162 } |
| 164 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, | 163 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, |
| 165 SkGpuDevice::kUninit_In
itContents)); | 164 SkGpuDevice::kUninit_In
itContents)); |
| 166 if (!device) { | 165 if (!device) { |
| 167 return nullptr; | 166 return nullptr; |
| 168 } | 167 } |
| 169 return new SkSurface_Gpu(device); | 168 return new SkSurface_Gpu(device); |
| 170 } | 169 } |
| 171 | 170 |
| 172 #endif | 171 #endif |
| OLD | NEW |