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

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: address code review comments 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 GPUAccelData : public SkPicture::AccelData {
2005 public:
2006 GPUAccelData(Key key) : INHERITED(key) { }
2007
2008 protected:
2009
2010 private:
2011 typedef SkPicture::AccelData INHERITED;
2012 };
2013
2014 // In the future this may not be a static method if we need to incorporate the
2015 // clip and matrix state into the key
2016 SkPicture::AccelData::Key SkGpuDevice::ComputeAccelDataKey() {
2017 static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::Genera teDomain();
2018
2019 return gGPUID;
2020 }
2021
2022 void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
2023 SkPicture::AccelData::Key key = ComputeAccelDataKey();
2024
2025 GPUAccelData* data = SkNEW_ARGS(GPUAccelData, (key));
2026
2027 picture->EXPERIMENTAL_addAccelData(data);
2028 }
2029
2030 bool SkGpuDevice::EXPERIMENTAL_drawPicture(const SkPicture& picture) {
2031 SkPicture::AccelData::Key key = ComputeAccelDataKey();
2032
2033 const SkPicture::AccelData* data = picture.EXPERIMENTAL_getAccelData(key);
2034 if (NULL == data) {
2035 return false;
2036 }
2037
2038 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
2039 gpuData;
2040
2041 return false;
2042 }
OLDNEW
« src/core/SkPicture.cpp ('K') | « src/core/SkPicture.cpp ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698