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 |