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

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

Issue 283703007: Update layer-pre-rendering for Chrome flag (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 } 1935 }
1936 } 1936 }
1937 1937
1938 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { 1938 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) {
1939 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples( )); 1939 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples( ));
1940 } 1940 }
1941 1941
1942 void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) { 1942 void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) {
1943 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); 1943 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
1944 1944
1945 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y);
1946 if (NULL != existing) {
1947 return;
1948 }
1949
1945 SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key))); 1950 SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key)));
1946 1951
1947 picture->EXPERIMENTAL_addAccelData(data); 1952 picture->EXPERIMENTAL_addAccelData(data);
1948 1953
1949 GatherGPUInfo(picture, data); 1954 GatherGPUInfo(picture, data);
1950 } 1955 }
1951 1956
1952 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re sult) { 1957 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re sult) {
1953 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); 1958 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
1954 result->setConfig(info); 1959 result->setConfig(info);
1955 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); 1960 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
1956 } 1961 }
1957 1962
1958 void SkGpuDevice::EXPERIMENTAL_purge(SkPicture* picture) { 1963 void SkGpuDevice::EXPERIMENTAL_purge(SkPicture* picture) {
1959 1964
1960 } 1965 }
1961 1966
1962 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture) { 1967 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture) {
1963 1968
1964 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); 1969 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
1965 1970
1966 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); 1971 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key);
1967 if (NULL == data) { 1972 if (NULL == data) {
1968 return false; 1973 return false;
1969 } 1974 }
1970 1975
1971 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data); 1976 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
1972 1977
1978 if (0 == gpuData->numSaveLayers()) {
1979 return false;
1980 }
1981
1973 SkAutoTArray<bool> pullForward(gpuData->numSaveLayers()); 1982 SkAutoTArray<bool> pullForward(gpuData->numSaveLayers());
1974 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { 1983 for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
1975 pullForward[i] = false; 1984 pullForward[i] = false;
1976 } 1985 }
1977 1986
1978 SkRect clipBounds; 1987 SkRect clipBounds;
1979 if (!canvas->getClipBounds(&clipBounds)) { 1988 if (!canvas->getClipBounds(&clipBounds)) {
1980 return true; 1989 return true;
1981 } 1990 }
1982 SkIRect query; 1991 SkIRect query;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i); 2129 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i);
2121 2130
2122 if (NULL != layer->getTexture()) { 2131 if (NULL != layer->getTexture()) {
2123 fContext->unlockScratchTexture(layer->getTexture()); 2132 fContext->unlockScratchTexture(layer->getTexture());
2124 layer->setTexture(NULL); 2133 layer->setTexture(NULL);
2125 } 2134 }
2126 } 2135 }
2127 2136
2128 return true; 2137 return true;
2129 } 2138 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698