OLD | NEW |
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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "skia/ext/image_operations.h" | 9 #include "skia/ext/image_operations.h" |
10 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 alpha_(alpha) { | 160 alpha_(alpha) { |
161 } | 161 } |
162 | 162 |
163 virtual ~MaskedImageSource() { | 163 virtual ~MaskedImageSource() { |
164 } | 164 } |
165 | 165 |
166 // gfx::ImageSkiaSource overrides: | 166 // gfx::ImageSkiaSource overrides: |
167 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { | 167 virtual ImageSkiaRep GetImageForScale(ui::ScaleFactor scale_factor) OVERRIDE { |
168 ImageSkiaRep rgb_rep = rgb_.GetRepresentation(scale_factor); | 168 ImageSkiaRep rgb_rep = rgb_.GetRepresentation(scale_factor); |
169 ImageSkiaRep alpha_rep = alpha_.GetRepresentation(scale_factor); | 169 ImageSkiaRep alpha_rep = alpha_.GetRepresentation(scale_factor); |
170 MatchScale(&rgb_rep, &alpha_rep); | |
171 return ImageSkiaRep(SkBitmapOperations::CreateMaskedBitmap( | 170 return ImageSkiaRep(SkBitmapOperations::CreateMaskedBitmap( |
172 rgb_rep.sk_bitmap(), alpha_rep.sk_bitmap()), | 171 rgb_rep.sk_bitmap(), alpha_rep.sk_bitmap()), |
173 rgb_rep.scale_factor()); | 172 rgb_rep.scale_factor()); |
174 } | 173 } |
175 | 174 |
176 private: | 175 private: |
177 const ImageSkia rgb_; | 176 const ImageSkia rgb_; |
178 const ImageSkia alpha_; | 177 const ImageSkia alpha_; |
179 | 178 |
180 DISALLOW_COPY_AND_ASSIGN(MaskedImageSource); | 179 DISALLOW_COPY_AND_ASSIGN(MaskedImageSource); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 const ImageSkia& source, | 495 const ImageSkia& source, |
497 SkBitmapOperations::RotationAmount rotation) { | 496 SkBitmapOperations::RotationAmount rotation) { |
498 return ImageSkia(new RotatedSource(source, rotation), | 497 return ImageSkia(new RotatedSource(source, rotation), |
499 SkBitmapOperations::ROTATION_180_CW == rotation ? | 498 SkBitmapOperations::ROTATION_180_CW == rotation ? |
500 source.size() : | 499 source.size() : |
501 gfx::Size(source.height(), source.width())); | 500 gfx::Size(source.height(), source.width())); |
502 | 501 |
503 } | 502 } |
504 | 503 |
505 } // namespace gfx | 504 } // namespace gfx |
OLD | NEW |