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

Side by Side Diff: ash/wm/image_grid.cc

Issue 10391165: Notification for device scale factor change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: demo_main fix Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/image_grid.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('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 "ash/wm/image_grid.h" 5 #include "ash/wm/image_grid.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 layer->SchedulePaint(layer->bounds()); 223 layer->SchedulePaint(layer->bounds());
224 } 224 }
225 } 225 }
226 226
227 void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { 227 void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) {
228 if (!clip_rect_.IsEmpty()) 228 if (!clip_rect_.IsEmpty())
229 canvas->ClipRect(clip_rect_); 229 canvas->ClipRect(clip_rect_);
230 canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0); 230 canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0);
231 } 231 }
232 232
233 void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged(
234 float device_scale_factor) {
235 // Redrawing will take care of scale factor change.
236 }
237
233 // static 238 // static
234 gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) { 239 gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) {
235 return image ? 240 return image ?
236 gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) : 241 gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) :
237 gfx::Size(); 242 gfx::Size();
238 } 243 }
239 244
240 // static 245 // static
241 bool ImageGrid::LayerExceedsSize(const ui::Layer* layer, 246 bool ImageGrid::LayerExceedsSize(const ui::Layer* layer,
242 const gfx::Size& size) { 247 const gfx::Size& size) {
(...skipping 22 matching lines...) Expand all
265 270
266 painter_ptr->reset(new ImagePainter(image)); 271 painter_ptr->reset(new ImagePainter(image));
267 layer_ptr->get()->set_delegate(painter_ptr->get()); 272 layer_ptr->get()->set_delegate(painter_ptr->get());
268 layer_ptr->get()->SetFillsBoundsOpaquely(false); 273 layer_ptr->get()->SetFillsBoundsOpaquely(false);
269 layer_ptr->get()->SetVisible(true); 274 layer_ptr->get()->SetVisible(true);
270 layer_->Add(layer_ptr->get()); 275 layer_->Add(layer_ptr->get());
271 } 276 }
272 277
273 } // namespace internal 278 } // namespace internal
274 } // namespace ash 279 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/image_grid.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698