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

Unified Diff: ui/gfx/skia_util.cc

Issue 1363253002: ui/gfx: use SkLayerDrawLooper::Builder::addLayerOnTop instead of addLayer Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skia_util.cc
diff --git a/ui/gfx/skia_util.cc b/ui/gfx/skia_util.cc
index ef07241ba5778efd278d269f626852544574890f..90602f50f228aaaf533d0fa4e6a5a1be26825c85 100644
--- a/ui/gfx/skia_util.cc
+++ b/ui/gfx/skia_util.cc
@@ -4,6 +4,7 @@
#include "ui/gfx/skia_util.h"
+#include "base/containers/adapters.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkColorPriv.h"
@@ -126,16 +127,12 @@ skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper(
SkLayerDrawLooper::Builder looper_builder;
- looper_builder.addLayer(); // top layer of the original.
-
SkLayerDrawLooper::LayerInfo layer_info;
layer_info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit;
layer_info.fPaintBits |= SkLayerDrawLooper::kColorFilter_Bit;
layer_info.fColorMode = SkXfermode::kSrc_Mode;
- for (size_t i = 0; i < shadows.size(); ++i) {
- const ShadowValue& shadow = shadows[i];
-
+ for (const ShadowValue& shadow : base::Reversed(shadows)) {
layer_info.fOffset.set(SkIntToScalar(shadow.x()),
SkIntToScalar(shadow.y()));
@@ -149,11 +146,14 @@ skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper(
SkColorFilter::CreateModeFilter(shadow.color(),
SkXfermode::kSrcIn_Mode));
- SkPaint* paint = looper_builder.addLayer(layer_info);
+ SkPaint* paint = looper_builder.addLayerOnTop(layer_info);
paint->setMaskFilter(blur_mask.get());
paint->setColorFilter(color_filter.get());
}
+ // Top layer of the original.
+ looper_builder.addLayerOnTop(SkLayerDrawLooper::LayerInfo());
+
return skia::AdoptRef<SkDrawLooper>(looper_builder.detachLooper());
}
« 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