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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 SkSurface_Gpu::~SkSurface_Gpu() { | 26 SkSurface_Gpu::~SkSurface_Gpu() { |
27 fDevice->unref(); | 27 fDevice->unref(); |
28 } | 28 } |
29 | 29 |
30 SkCanvas* SkSurface_Gpu::onNewCanvas() { | 30 SkCanvas* SkSurface_Gpu::onNewCanvas() { |
31 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; | 31 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; |
32 // When we think this works... | 32 // When we think this works... |
33 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; | 33 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; |
34 | 34 |
35 return SkNEW_ARGS(SkCanvas, (fDevice, &this->props(), flags)); | 35 return SkNEW_ARGS(SkCanvas, (fDevice, flags)); |
36 } | 36 } |
37 | 37 |
38 SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) { | 38 SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) { |
39 GrRenderTarget* rt = fDevice->accessRenderTarget(); | 39 GrRenderTarget* rt = fDevice->accessRenderTarget(); |
40 int sampleCount = rt->numColorSamples(); | 40 int sampleCount = rt->numColorSamples(); |
41 // TODO: Make caller specify this (change virtual signature of onNewSurface)
. | 41 // TODO: Make caller specify this (change virtual signature of onNewSurface)
. |
42 static const Budgeted kBudgeted = kNo_Budgeted; | 42 static const Budgeted kBudgeted = kNo_Budgeted; |
43 return SkSurface::NewRenderTarget(fDevice->context(), kBudgeted, info, sampl
eCount, | 43 return SkSurface::NewRenderTarget(fDevice->context(), kBudgeted, info, sampl
eCount, |
44 &this->props()); | 44 &this->props()); |
45 } | 45 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return NULL; | 115 return NULL; |
116 } | 116 } |
117 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props)); | 117 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props)); |
118 if (!device) { | 118 if (!device) { |
119 return NULL; | 119 return NULL; |
120 } | 120 } |
121 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 121 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
122 } | 122 } |
123 | 123 |
124 #endif | 124 #endif |
OLD | NEW |