Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: src/image/SkSurface_Gpu.cpp

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "GrGpuResourceCacheAccess.h" 10 #include "GrGpuResourceCacheAccess.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkGpuDevice.h" 12 #include "SkGpuDevice.h"
13 #include "SkImage_Base.h" 13 #include "SkImage_Base.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 20
21 SkSurface_Gpu::SkSurface_Gpu(SkGpuDevice* device) 21 SkSurface_Gpu::SkSurface_Gpu(SkGpuDevice* device)
22 : INHERITED(device->width(), device->height(), &device->surfaceProps()) 22 : INHERITED(device->width(), device->height(), &device->surfaceProps())
23 , fDevice(SkRef(device)) { 23 , fDevice(SkRef(device)) {
24 fDevice->setSurfaceBase(this);
24 } 25 }
25 26
26 SkSurface_Gpu::~SkSurface_Gpu() { 27 SkSurface_Gpu::~SkSurface_Gpu() {
28 fDevice->setSurfaceBase(NULL);
27 SkSafeUnref(fDevice); 29 SkSafeUnref(fDevice);
28 } 30 }
29 31
30 SkCanvas* SkSurface_Gpu::onNewCanvas() { 32 SkCanvas* SkSurface_Gpu::onNewCanvas() {
31 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags; 33 SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags;
32 // When we think this works... 34 // When we think this works...
33 // flags |= SkCanvas::kConservativeRasterClip_InitFlag; 35 // flags |= SkCanvas::kConservativeRasterClip_InitFlag;
34 36
35 return SkNEW_ARGS(SkCanvas, (fDevice, &this->props(), flags)); 37 return SkNEW_ARGS(SkCanvas, (fDevice, &this->props(), flags));
36 } 38 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 int sampleCount, const SkSurfaceProps* pro ps) { 111 int sampleCount, const SkSurfaceProps* pro ps) {
110 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props, 112 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sa mpleCount, props,
111 SkGpuDevice::kNeedClear _Flag)); 113 SkGpuDevice::kNeedClear _Flag));
112 if (!device) { 114 if (!device) {
113 return NULL; 115 return NULL;
114 } 116 }
115 return SkNEW_ARGS(SkSurface_Gpu, (device)); 117 return SkNEW_ARGS(SkSurface_Gpu, (device));
116 } 118 }
117 119
118 #endif 120 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698