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

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

Issue 197123003: Proposed SkCanvas API for preLoading textures to VRAM v2.0 (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 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/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
11 #include "effects/GrTextureDomain.h" 11 #include "effects/GrTextureDomain.h"
12 #include "effects/GrSimpleTextureEffect.h" 12 #include "effects/GrSimpleTextureEffect.h"
13 13
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "GrBitmapTextContext.h" 15 #include "GrBitmapTextContext.h"
16 #include "GrDistanceFieldTextContext.h" 16 #include "GrDistanceFieldTextContext.h"
17 17
18 #include "SkGrTexturePixelRef.h" 18 #include "SkGrTexturePixelRef.h"
19 19
20 #include "SkBounder.h" 20 #include "SkBounder.h"
21 #include "SkColorFilter.h" 21 #include "SkColorFilter.h"
22 #include "SkDeviceImageFilterProxy.h" 22 #include "SkDeviceImageFilterProxy.h"
23 #include "SkDrawProcs.h" 23 #include "SkDrawProcs.h"
24 #include "SkGlyphCache.h" 24 #include "SkGlyphCache.h"
25 #include "SkImageFilter.h" 25 #include "SkImageFilter.h"
26 #include "SkMaskFilter.h" 26 #include "SkMaskFilter.h"
27 #include "SkPathEffect.h" 27 #include "SkPathEffect.h"
28 #include "SkPicture.h"
28 #include "SkRRect.h" 29 #include "SkRRect.h"
29 #include "SkStroke.h" 30 #include "SkStroke.h"
30 #include "SkSurface.h" 31 #include "SkSurface.h"
31 #include "SkTLazy.h" 32 #include "SkTLazy.h"
32 #include "SkUtils.h" 33 #include "SkUtils.h"
33 #include "SkErrorInternals.h" 34 #include "SkErrorInternals.h"
34 35
35 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 36 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1
36 37
37 #if 0 38 #if 0
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 GrTexture* texture, 1993 GrTexture* texture,
1993 bool needClear) 1994 bool needClear)
1994 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1995 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1995 1996
1996 SkASSERT(texture && texture->asRenderTarget()); 1997 SkASSERT(texture && texture->asRenderTarget());
1997 // This constructor is called from onCreateDevice. It has locked the RT in t he texture 1998 // This constructor is called from onCreateDevice. It has locked the RT in t he texture
1998 // cache. We pass true for the third argument so that it will get unlocked. 1999 // cache. We pass true for the third argument so that it will get unlocked.
1999 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 2000 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
2000 fNeedClear = needClear; 2001 fNeedClear = needClear;
2001 } 2002 }
2003
2004 class SkGPUAccelData : public SkPicture::SkAccelData {
2005 public:
2006 static const int32_t kGPUID = 0x01;
bsalomon 2014/03/12 15:34:34 Maybe can grab this from an atomic inc at runtime
robertphillips 2014/03/13 12:43:42 Done.
2007
2008 SkGPUAccelData() : INHERITED(kGPUID) { }
2009
2010 protected:
2011
2012 private:
2013 typedef SkPicture::SkAccelData INHERITED;
2014 };
2015
2016 void SkGpuDevice::optimize(SkPicture* picture) {
2017 SkGPUAccelData* data = SkNEW(SkGPUAccelData);
2018
2019 picture->setAccelData(data);
2020 }
2021
2022 bool SkGpuDevice::optimizedRender(SkPicture& picture) {
2023 const SkPicture::SkAccelData* data = picture.getAccelData();
2024 if (NULL == data) {
2025 return false;
2026 }
2027
2028 if (SkGPUAccelData::kGPUID != data->getID()) {
2029 return false;
2030 }
2031
2032 const SkGPUAccelData *gpuData = static_cast<const SkGPUAccelData*>(data);
2033 gpuData;
2034
2035 return false;
2036 }
OLDNEW
« include/core/SkPicture.h ('K') | « src/core/SkPicture.cpp ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698