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

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

Issue 1372153006: SkImage doesn't use props, so don't need to store it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 SkImage* SkSurface_Gpu::onNewImageSnapshot(Budgeted budgeted) { 80 SkImage* SkSurface_Gpu::onNewImageSnapshot(Budgeted budgeted) {
81 const SkImageInfo info = fDevice->imageInfo(); 81 const SkImageInfo info = fDevice->imageInfo();
82 SkImage* image = nullptr; 82 SkImage* image = nullptr;
83 GrTexture* tex = fDevice->accessRenderTarget()->asTexture(); 83 GrTexture* tex = fDevice->accessRenderTarget()->asTexture();
84 if (tex) { 84 if (tex) {
85 image = new SkImage_Gpu(info.width(), info.height(), kNeedNewImageUnique ID, 85 image = new SkImage_Gpu(info.width(), info.height(), kNeedNewImageUnique ID,
86 info.alphaType(), tex, budgeted); 86 info.alphaType(), tex, budgeted);
87 } 87 }
88 if (image) {
89 as_IB(image)->initWithProps(this->props());
90 }
91 return image; 88 return image;
92 } 89 }
93 90
94 // Create a new render target and, if necessary, copy the contents of the old 91 // Create a new render target and, if necessary, copy the contents of the old
95 // render target into it. Note that this flushes the SkGpuDevice but 92 // render target into it. Note that this flushes the SkGpuDevice but
96 // doesn't force an OpenGL flush. 93 // doesn't force an OpenGL flush.
97 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { 94 void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
98 GrRenderTarget* rt = fDevice->accessRenderTarget(); 95 GrRenderTarget* rt = fDevice->accessRenderTarget();
99 // are we sharing our render target with the image? Note this call should ne ver create a new 96 // are we sharing our render target with the image? Note this call should ne ver create a new
100 // image because onCopyOnWrite is only called when there is a cached image. 97 // image because onCopyOnWrite is only called when there is a cached image.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 163 }
167 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, 164 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props,
168 SkGpuDevice::kUninit_In itContents)); 165 SkGpuDevice::kUninit_In itContents));
169 if (!device) { 166 if (!device) {
170 return nullptr; 167 return nullptr;
171 } 168 }
172 return new SkSurface_Gpu(device); 169 return new SkSurface_Gpu(device);
173 } 170 }
174 171
175 #endif 172 #endif
OLDNEW
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698