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

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

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Moved code around to make code review easier Created 7 years, 4 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
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return NULL; 154 return NULL;
155 } 155 }
156 if (surface->asTexture()) { 156 if (surface->asTexture()) {
157 return SkNEW_ARGS(SkGpuDevice, (surface->getContext(), surface->asTextur e())); 157 return SkNEW_ARGS(SkGpuDevice, (surface->getContext(), surface->asTextur e()));
158 } else { 158 } else {
159 return SkNEW_ARGS(SkGpuDevice, (surface->getContext(), surface->asRender Target())); 159 return SkNEW_ARGS(SkGpuDevice, (surface->getContext(), surface->asRender Target()));
160 } 160 }
161 } 161 }
162 162
163 SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture) 163 SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture)
164 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { 164 : SkRasterDevice(make_bitmap(context, texture->asRenderTarget())) {
165 this->initFromRenderTarget(context, texture->asRenderTarget(), false); 165 this->initFromRenderTarget(context, texture->asRenderTarget(), false);
166 } 166 }
167 167
168 SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget) 168 SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget)
169 : SkDevice(make_bitmap(context, renderTarget)) { 169 : SkRasterDevice(make_bitmap(context, renderTarget)) {
170 this->initFromRenderTarget(context, renderTarget, false); 170 this->initFromRenderTarget(context, renderTarget, false);
171 } 171 }
172 172
173 void SkGpuDevice::initFromRenderTarget(GrContext* context, 173 void SkGpuDevice::initFromRenderTarget(GrContext* context,
174 GrRenderTarget* renderTarget, 174 GrRenderTarget* renderTarget,
175 bool cached) { 175 bool cached) {
176 fDrawProcs = NULL; 176 fDrawProcs = NULL;
177 177
178 fContext = context; 178 fContext = context;
179 fContext->ref(); 179 fContext->ref();
(...skipping 16 matching lines...) Expand all
196 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (surface, cached)); 196 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (surface, cached));
197 197
198 this->setPixelRef(pr, 0)->unref(); 198 this->setPixelRef(pr, 0)->unref();
199 } 199 }
200 200
201 SkGpuDevice::SkGpuDevice(GrContext* context, 201 SkGpuDevice::SkGpuDevice(GrContext* context,
202 SkBitmap::Config config, 202 SkBitmap::Config config,
203 int width, 203 int width,
204 int height, 204 int height,
205 int sampleCount) 205 int sampleCount)
206 : SkDevice(config, width, height, false /*isOpaque*/) { 206 : SkRasterDevice(config, width, height, false /*isOpaque*/) {
207 207
208 fDrawProcs = NULL; 208 fDrawProcs = NULL;
209 209
210 fContext = context; 210 fContext = context;
211 fContext->ref(); 211 fContext->ref();
212 212
213 fRenderTarget = NULL; 213 fRenderTarget = NULL;
214 fNeedClear = false; 214 fNeedClear = false;
215 215
216 if (config != SkBitmap::kRGB_565_Config) { 216 if (config != SkBitmap::kRGB_565_Config) {
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 return SkNEW_ARGS(SkGpuDevice,(fContext, texture, needClear)); 1780 return SkNEW_ARGS(SkGpuDevice,(fContext, texture, needClear));
1781 } else { 1781 } else {
1782 GrPrintf("---- failed to create compatible device texture [%d %d]\n", wi dth, height); 1782 GrPrintf("---- failed to create compatible device texture [%d %d]\n", wi dth, height);
1783 return NULL; 1783 return NULL;
1784 } 1784 }
1785 } 1785 }
1786 1786
1787 SkGpuDevice::SkGpuDevice(GrContext* context, 1787 SkGpuDevice::SkGpuDevice(GrContext* context,
1788 GrTexture* texture, 1788 GrTexture* texture,
1789 bool needClear) 1789 bool needClear)
1790 : SkDevice(make_bitmap(context, texture->asRenderTarget())) { 1790 : SkRasterDevice(make_bitmap(context, texture->asRenderTarget())) {
1791 1791
1792 GrAssert(texture && texture->asRenderTarget()); 1792 GrAssert(texture && texture->asRenderTarget());
1793 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1793 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1794 // cache. We pass true for the third argument so that it will get unlocked. 1794 // cache. We pass true for the third argument so that it will get unlocked.
1795 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1795 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1796 fNeedClear = needClear; 1796 fNeedClear = needClear;
1797 } 1797 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698