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

Side by Side Diff: ui/gfx/image/image_skia_operations.cc

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/harfbuzz_font_skia.cc ('k') | ui/gfx/nine_image_painter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/image/image_skia_operations.h" 5 #include "ui/gfx/image/image_skia_operations.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 public: 403 public:
404 HorizontalShadowSource(const std::vector<ShadowValue>& shadows, 404 HorizontalShadowSource(const std::vector<ShadowValue>& shadows,
405 bool fades_down) 405 bool fades_down)
406 : CanvasImageSource(Size(1, GetHeightForShadows(shadows)), false), 406 : CanvasImageSource(Size(1, GetHeightForShadows(shadows)), false),
407 shadows_(shadows), 407 shadows_(shadows),
408 fades_down_(fades_down) {} 408 fades_down_(fades_down) {}
409 ~HorizontalShadowSource() override {} 409 ~HorizontalShadowSource() override {}
410 410
411 // CanvasImageSource overrides: 411 // CanvasImageSource overrides:
412 void Draw(Canvas* canvas) override { 412 void Draw(Canvas* canvas) override {
413 SkPaint paint; 413 CdlPaint paint;
414 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_)); 414 paint.setLooper(CreateShadowDrawLooperCorrectBlur(shadows_));
415 canvas->DrawRect(RectF(0, fades_down_ ? -1 : size().height(), 1, 1), paint); 415 canvas->DrawRect(RectF(0, fades_down_ ? -1 : size().height(), 1, 1), paint);
416 } 416 }
417 417
418 private: 418 private:
419 static int GetHeightForShadows(const std::vector<ShadowValue>& shadows) { 419 static int GetHeightForShadows(const std::vector<ShadowValue>& shadows) {
420 int height = 0; 420 int height = 0;
421 for (const auto& shadow : shadows) { 421 for (const auto& shadow : shadows) {
422 height = std::max(height, shadow.y() + ToCeiledInt(shadow.blur() / 2)); 422 height = std::max(height, shadow.y() + ToCeiledInt(shadow.blur() / 2));
423 } 423 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 if (icon.isNull()) 620 if (icon.isNull())
621 return ImageSkia(); 621 return ImageSkia();
622 622
623 if (badge.isNull()) 623 if (badge.isNull())
624 return icon; 624 return icon;
625 625
626 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size()); 626 return ImageSkia(new IconWithBadgeSource(icon, badge), icon.size());
627 } 627 }
628 628
629 } // namespace gfx 629 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/harfbuzz_font_skia.cc ('k') | ui/gfx/nine_image_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698