From 6617d509ab0b056c57952bb1ee04b4c94904284b Mon Sep 17 00:00:00 2001 From: robertphillips Date: Mon, 18 Aug 2014 09:39:34 -0700 Subject: [PATCH] Rename GPUAccelData to GrAccelData This is calved off of (Add new API to allow layer hoisting/atlasing across picture piles - https://codereview.chromium.org/474623002/) R=bsalomon@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/482773002 --- src/gpu/GrPictureUtils.cpp | 12 ++++++------ src/gpu/GrPictureUtils.h | 8 ++++---- src/gpu/SkGpuDevice.cpp | 18 +++++++++--------- tests/PictureTest.cpp | 14 +++++++------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/gpu/GrPictureUtils.cpp b/src/gpu/GrPictureUtils.cpp index 6e3c6b7ef..7295089e8 100644 --- a/src/gpu/GrPictureUtils.cpp +++ b/src/gpu/GrPictureUtils.cpp @@ -13,14 +13,14 @@ #include "SkPictureData.h" #include "SkPicturePlayback.h" -SkPicture::AccelData::Key GPUAccelData::ComputeAccelDataKey() { +SkPicture::AccelData::Key GrAccelData::ComputeAccelDataKey() { static const SkPicture::AccelData::Key gGPUID = SkPicture::AccelData::GenerateDomain(); return gGPUID; } // The GrGather device performs GPU-backend-specific preprocessing on -// a picture. The results are stored in a GPUAccelData. +// a picture. The results are stored in a GrAccelData. // // Currently the only interesting work is done in drawDevice (i.e., when a // saveLayer is collapsed back into its parent) and, maybe, in onCreateDevice. @@ -31,7 +31,7 @@ class GrGatherDevice : public SkBaseDevice { public: SK_DECLARE_INST_COUNT(GrGatherDevice) - GrGatherDevice(int width, int height, SkPicturePlayback* playback, GPUAccelData* accelData, + GrGatherDevice(int width, int height, SkPicturePlayback* playback, GrAccelData* accelData, int saveLayerDepth) { fPlayback = playback; fSaveLayerDepth = saveLayerDepth; @@ -171,14 +171,14 @@ private: SkBitmap fEmptyBitmap; // legacy -- need to remove // All information gathered during the gather process is stored here - GPUAccelData* fAccelData; + GrAccelData* fAccelData; // true if this device has already been drawn back to its parent(s) at least // once. bool fAlreadyDrawn; // The information regarding the saveLayer call this device represents. - GPUAccelData::SaveLayerInfo fInfo; + GrAccelData::SaveLayerInfo fInfo; // The depth of this device in the saveLayer stack int fSaveLayerDepth; @@ -259,7 +259,7 @@ private: // GatherGPUInfo is only intended to be called within the context of SkGpuDevice's // EXPERIMENTAL_optimize method. -void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData) { +void GatherGPUInfo(const SkPicture* pict, GrAccelData* accelData) { if (NULL == pict || 0 == pict->width() || 0 == pict->height()) { return ; } diff --git a/src/gpu/GrPictureUtils.h b/src/gpu/GrPictureUtils.h index a730697d6..46af12d2f 100644 --- a/src/gpu/GrPictureUtils.h +++ b/src/gpu/GrPictureUtils.h @@ -13,7 +13,7 @@ // This class encapsulates the GPU-backend-specific acceleration data // for a single SkPicture -class GPUAccelData : public SkPicture::AccelData { +class GrAccelData : public SkPicture::AccelData { public: // Information about a given saveLayer in an SkPicture struct SaveLayerInfo { @@ -43,9 +43,9 @@ public: bool fIsNested; }; - GPUAccelData(Key key) : INHERITED(key) { } + GrAccelData(Key key) : INHERITED(key) { } - virtual ~GPUAccelData() { + virtual ~GrAccelData() { for (int i = 0; i < fSaveLayerInfo.count(); ++i) { SkDELETE(fSaveLayerInfo[i].fPaint); } @@ -74,6 +74,6 @@ private: typedef SkPicture::AccelData INHERITED; }; -void GatherGPUInfo(const SkPicture* pict, GPUAccelData* accelData); +void GatherGPUInfo(const SkPicture* pict, GrAccelData* accelData); #endif // GrPictureUtils_DEFINED diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 64439a188..f2bd025a0 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1854,14 +1854,14 @@ void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { return; } - SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); + SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(key); if (NULL != existing) { return; } - SkAutoTUnref data(SkNEW_ARGS(GPUAccelData, (key))); + SkAutoTUnref data(SkNEW_ARGS(GrAccelData, (key))); picture->EXPERIMENTAL_addAccelData(data); @@ -1885,14 +1885,14 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture fContext->getLayerCache()->processDeletedPictures(); - SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); + SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); if (NULL == data) { return false; } - const GPUAccelData *gpuData = static_cast(data); + const GrAccelData *gpuData = static_cast(data); if (0 == gpuData->numSaveLayers()) { return false; @@ -1925,11 +1925,11 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture for (int i = 0; i < ops->numOps(); ++i) { uint32_t offset = ops->offset(i); - // For now we're saving all the layers in the GPUAccelData so they + // For now we're saving all the layers in the GrAccelData so they // can be nested. Additionally, the nested layers appear before // their parent in the list. for (int j = 0 ; j < gpuData->numSaveLayers(); ++j) { - const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); + const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); if (pullForward[j]) { continue; // already pulling forward @@ -1955,7 +1955,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture // In this case there is no BBH associated with the picture. Pre-render // all the layers that intersect the drawn region for (int j = 0; j < gpuData->numSaveLayers(); ++j) { - const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); + const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); SkIRect layerRect = SkIRect::MakeXYWH(info.fOffset.fX, info.fOffset.fY, @@ -1987,7 +1987,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture // Generate the layer and/or ensure it is locked for (int i = 0; i < gpuData->numSaveLayers(); ++i) { if (pullForward[i]) { - const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); + const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(picture->uniqueID(), info.fSaveLayerOpID, @@ -2125,7 +2125,7 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture // unlock the layers for (int i = 0; i < gpuData->numSaveLayers(); ++i) { - const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); + const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture->uniqueID(), info.fSaveLayerOpID, diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index 7abef0edc..b3f13f03a 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -860,20 +860,20 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter, canvas->EXPERIMENTAL_optimize(pict); - SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); + SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(key); REPORTER_ASSERT(reporter, NULL != data); - const GPUAccelData *gpuData = static_cast(data); + const GrAccelData *gpuData = static_cast(data); REPORTER_ASSERT(reporter, 5 == gpuData->numSaveLayers()); - const GPUAccelData::SaveLayerInfo& info0 = gpuData->saveLayerInfo(0); + const GrAccelData::SaveLayerInfo& info0 = gpuData->saveLayerInfo(0); // The parent/child layer appear in reverse order - const GPUAccelData::SaveLayerInfo& info1 = gpuData->saveLayerInfo(2); - const GPUAccelData::SaveLayerInfo& info2 = gpuData->saveLayerInfo(1); - const GPUAccelData::SaveLayerInfo& info3 = gpuData->saveLayerInfo(3); -// const GPUAccelData::SaveLayerInfo& info4 = gpuData->saveLayerInfo(4); + const GrAccelData::SaveLayerInfo& info1 = gpuData->saveLayerInfo(2); + const GrAccelData::SaveLayerInfo& info2 = gpuData->saveLayerInfo(1); + const GrAccelData::SaveLayerInfo& info3 = gpuData->saveLayerInfo(3); +// const GrAccelData::SaveLayerInfo& info4 = gpuData->saveLayerInfo(4); REPORTER_ASSERT(reporter, info0.fValid); REPORTER_ASSERT(reporter, kWidth == info0.fSize.fWidth && kHeight == info0.fSize.fHeight);