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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 13211002: Make GM render to render targets that are also textures. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrTextureDomainEffect.h" 10 #include "effects/GrTextureDomainEffect.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 GrPixelConfig config = renderTarget->config(); 160 GrPixelConfig config = renderTarget->config();
161 161
162 bool isOpaque; 162 bool isOpaque;
163 SkBitmap bitmap; 163 SkBitmap bitmap;
164 bitmap.setConfig(grConfig2skConfig(config, &isOpaque), 164 bitmap.setConfig(grConfig2skConfig(config, &isOpaque),
165 renderTarget->width(), renderTarget->height()); 165 renderTarget->width(), renderTarget->height());
166 bitmap.setIsOpaque(isOpaque); 166 bitmap.setIsOpaque(isOpaque);
167 return bitmap; 167 return bitmap;
168 } 168 }
169 169
170 SkGpuDevice* SkGpuDevice::Create(GrSurface* surface) {
171 GrAssert(NULL != surface);
172 if (NULL == surface->asRenderTarget() || NULL == surface->getContext()) {
173 return NULL;
174 }
175 if (surface->asTexture()) {
176 return SkNEW_ARGS(SkGpuDevice, (surface->getContext(), surface->asTextur e()));
177 } else {
178 return SkNEW_ARGS(SkGpuDevice, (surface->getContext(), surface->asRender Target()));
179 }
180 }
181
170 SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture) 182 SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture)
171 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { 183 : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
172 this->initFromRenderTarget(context, texture->asRenderTarget(), false); 184 this->initFromRenderTarget(context, texture->asRenderTarget(), false);
173 } 185 }
174 186
175 SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget) 187 SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget)
176 : SkDevice(make_bitmap(context, renderTarget)) { 188 : SkDevice(make_bitmap(context, renderTarget)) {
177 this->initFromRenderTarget(context, renderTarget, false); 189 this->initFromRenderTarget(context, renderTarget, false);
178 } 190 }
179 191
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 GrTexture* texture, 1848 GrTexture* texture,
1837 bool needClear) 1849 bool needClear)
1838 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { 1850 : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
1839 1851
1840 GrAssert(texture && texture->asRenderTarget()); 1852 GrAssert(texture && texture->asRenderTarget());
1841 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1853 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1842 // cache. We pass true for the third argument so that it will get unlocked. 1854 // cache. We pass true for the third argument so that it will get unlocked.
1843 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1855 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1844 fNeedClear = needClear; 1856 fNeedClear = needClear;
1845 } 1857 }
OLDNEW
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698