зеркало из https://github.com/mozilla/moz-skia.git
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
This commit is contained in:
Родитель
81d92659cf
Коммит
6617d509ab
|
@ -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 ;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key)));
|
||||
SkAutoTUnref<GrAccelData> 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<const GPUAccelData*>(data);
|
||||
const GrAccelData *gpuData = static_cast<const GrAccelData*>(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,
|
||||
|
|
|
@ -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<const GPUAccelData*>(data);
|
||||
const GrAccelData *gpuData = static_cast<const GrAccelData*>(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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче