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" |
11 #include "SkGpuDevice.h" | 11 #include "SkGpuDevice.h" |
12 #include "SkImage_Base.h" | 12 #include "SkImage_Base.h" |
13 #include "SkImage_Gpu.h" | 13 #include "SkImage_Gpu.h" |
14 #include "SkImagePriv.h" | 14 #include "SkImagePriv.h" |
15 #include "SkSurface_Base.h" | 15 #include "SkSurface_Base.h" |
16 | 16 |
17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
18 | 18 |
19 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
20 | |
21 SkSurface_Gpu::SkSurface_Gpu(SkGpuDevice* device) | 20 SkSurface_Gpu::SkSurface_Gpu(SkGpuDevice* device) |
22 : INHERITED(device->width(), device->height(), &device->surfaceProps()) | 21 : INHERITED(device->width(), device->height(), &device->surfaceProps()) |
23 , fDevice(SkRef(device)) { | 22 , fDevice(SkRef(device)) { |
24 } | 23 } |
25 | 24 |
26 SkSurface_Gpu::~SkSurface_Gpu() { | 25 SkSurface_Gpu::~SkSurface_Gpu() { |
27 fDevice->unref(); | 26 fDevice->unref(); |
28 } | 27 } |
29 | 28 |
30 SkCanvas* SkSurface_Gpu::onNewCanvas() { | 29 SkCanvas* SkSurface_Gpu::onNewCanvas() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return NULL; | 114 return NULL; |
116 } | 115 } |
117 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props)); | 116 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget
(), props)); |
118 if (!device) { | 117 if (!device) { |
119 return NULL; | 118 return NULL; |
120 } | 119 } |
121 return SkNEW_ARGS(SkSurface_Gpu, (device)); | 120 return SkNEW_ARGS(SkSurface_Gpu, (device)); |
122 } | 121 } |
123 | 122 |
124 #endif | 123 #endif |
OLD | NEW |