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

Unified Diff: gm/gmmain.cpp

Issue 803183003: Fix layer hoisting image filter corner cases (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkLayerInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gmmain.cpp
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index da4184db673d9364688ef91f227d57ac871984cc..9b2f9a13c2003710bcf3351e30b4f8457f05888e 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -655,18 +655,21 @@ public:
}
}
- static void generate_image_from_picture(GM* gm, const ConfigData& gRec,
+ static void generate_image_from_picture(GM* gm, const ConfigData& config,
+ GrSurface* gpuTarget,
SkPicture* pict, SkBitmap* bitmap,
SkScalar scale = SK_Scalar1,
bool tile = false) {
- SkISize size = gm->getISize();
- setup_bitmap(gRec, size, bitmap);
+ const SkISize size = gm->getISize();
- SkAutoTUnref<SkSurface> surf(SkSurface::NewRasterDirect(bitmap->info(),
- bitmap->getPixels(),
- bitmap->rowBytes()));
+ SkAutoTUnref<SkSurface> surf(CreateSurface(config, size, gpuTarget));
DrawPictureToSurface(surf, pict, scale, tile, false);
+
+ setup_bitmap(config, size, bitmap);
+
+ surf->readPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes(), 0, 0);
+
complete_bitmap(bitmap);
}
@@ -1630,10 +1633,12 @@ template <typename T> void appendUnique(SkTDArray<T>* array, const T& value) {
*
* Returns all errors encountered while doing so.
*/
-ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &compareConfig,
+ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm,
+ const ConfigData &compareConfig, GrSurface* gpuTarget,
const SkBitmap &comparisonBitmap,
const SkTDArray<SkScalar> &tileGridReplayScales);
-ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &compareConfig,
+ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm,
+ const ConfigData &compareConfig, GrSurface* gpuTarget,
const SkBitmap &comparisonBitmap,
const SkTDArray<SkScalar> &tileGridReplayScales) {
ErrorCombination errorsForAllModes;
@@ -1651,7 +1656,8 @@ ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
errorsForAllModes.add(kIntentionallySkipped_ErrorType);
} else {
SkBitmap bitmap;
- gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
+ gmmain.generate_image_from_picture(gm, compareConfig, gpuTarget, pict, &bitmap);
+
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
&comparisonBitmap));
@@ -1668,7 +1674,7 @@ ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
SkPicture* repict = gmmain.stream_to_new_picture(*pict);
SkAutoTUnref<SkPicture> aurr(repict);
SkBitmap bitmap;
- gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitmap);
+ gmmain.generate_image_from_picture(gm, compareConfig, gpuTarget, repict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
&comparisonBitmap));
@@ -1701,7 +1707,7 @@ ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
SkPicture* pict = gmmain.generate_new_picture(gm, kRTree_BbhType, 0);
SkAutoTUnref<SkPicture> aur(pict);
SkBitmap bitmap;
- gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
+ gmmain.generate_image_from_picture(gm, compareConfig, gpuTarget, pict, &bitmap);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap,
&comparisonBitmap));
@@ -1734,7 +1740,7 @@ ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
// We cannot yet pass 'true' to generate_image_from_picture to
// perform actual tiled rendering (see Issue 1198 -
// https://code.google.com/p/skia/issues/detail?id=1198)
- gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap,
+ gmmain.generate_image_from_picture(gm, compareConfig, gpuTarget, pict, &bitmap,
replayScale /*, true */);
errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitmap(
gm->getName(), compareConfig.fName, renderModeDescriptor.c_str(), bitmap,
@@ -1875,7 +1881,7 @@ ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm,
// TODO: run only if gmmain.test_drawing succeeded.
if (kRaster_Backend == config.fBackend) {
- run_multiple_modes(gmmain, gm, config, comparisonBitmap, tileGridReplayScales);
+ run_multiple_modes(gmmain, gm, config, gpuTarget, comparisonBitmap, tileGridReplayScales);
}
if (FLAGS_deferred && errorsForThisConfig.isEmpty() &&
« no previous file with comments | « no previous file | src/core/SkLayerInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698