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

Unified Diff: ui/aura_extra/image_window_delegate.cc

Issue 880703002: Move ImageWindowDelegate to ui/aura_extra (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated a comment Created 5 years, 11 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 | « ui/aura_extra/image_window_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_extra/image_window_delegate.cc
diff --git a/content/browser/web_contents/aura/image_window_delegate.cc b/ui/aura_extra/image_window_delegate.cc
similarity index 83%
rename from content/browser/web_contents/aura/image_window_delegate.cc
rename to ui/aura_extra/image_window_delegate.cc
index 25878ea2c1c7bac602238f13a5cdd3507d1c7abb..00b1030dd258dce7e273489d8461aded4eca16e4 100644
--- a/content/browser/web_contents/aura/image_window_delegate.cc
+++ b/ui/aura_extra/image_window_delegate.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/web_contents/aura/image_window_delegate.h"
+#include "ui/aura_extra/image_window_delegate.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/hit_test.h"
@@ -13,10 +13,11 @@
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
-namespace content {
+namespace aura_extra {
ImageWindowDelegate::ImageWindowDelegate()
- : size_mismatch_(false) {
+ : background_color_(SK_ColorWHITE),
+ size_mismatch_(false) {
}
ImageWindowDelegate::~ImageWindowDelegate() {
@@ -65,13 +66,12 @@ void ImageWindowDelegate::OnCaptureLost() {
}
void ImageWindowDelegate::OnPaint(gfx::Canvas* canvas) {
- if (image_.IsEmpty()) {
- canvas->DrawColor(SK_ColorWHITE);
- } else {
- if (size_mismatch_)
- canvas->DrawColor(SK_ColorWHITE);
- canvas->DrawImageInt(image_.AsImageSkia(), 0, 0);
+ if (background_color_ != SK_ColorTRANSPARENT &&
+ (image_.IsEmpty() || size_mismatch_ || !offset_.IsZero())) {
+ canvas->DrawColor(background_color_);
}
+ if (!image_.IsEmpty())
+ canvas->DrawImageInt(image_.AsImageSkia(), offset_.x(), offset_.y());
}
void ImageWindowDelegate::OnDeviceScaleFactorChanged(float scale_factor) {
@@ -94,4 +94,4 @@ bool ImageWindowDelegate::HasHitTestMask() const {
void ImageWindowDelegate::GetHitTestMask(gfx::Path* mask) const {
}
-} // namespace content
+} // namespace aura_extra
« no previous file with comments | « ui/aura_extra/image_window_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698