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

Side by Side Diff: chrome/renderer/pepper/pepper_pdf_host.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/renderer/pepper/pepper_pdf_host.h" 5 #include "chrome/renderer/pepper/pepper_pdf_host.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/common/render_messages.h" 8 #include "chrome/common/render_messages.h"
9 #include "chrome/renderer/printing/print_web_view_helper.h" 9 #include "chrome/renderer/printing/print_web_view_helper.h"
10 #include "content/public/common/referrer.h" 10 #include "content/public/common/referrer.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 int res_id = 0; 289 int res_id = 0;
290 for (size_t i = 0; i < arraysize(kResourceImageMap); ++i) { 290 for (size_t i = 0; i < arraysize(kResourceImageMap); ++i) {
291 if (kResourceImageMap[i].pp_id == image_id) { 291 if (kResourceImageMap[i].pp_id == image_id) {
292 res_id = kResourceImageMap[i].res_id; 292 res_id = kResourceImageMap[i].res_id;
293 break; 293 break;
294 } 294 }
295 } 295 }
296 if (res_id == 0) 296 if (res_id == 0)
297 return PP_ERROR_FAILED; 297 return PP_ERROR_FAILED;
298 298
299 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale);
300
301 gfx::ImageSkia* res_image_skia = 299 gfx::ImageSkia* res_image_skia =
302 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(res_id); 300 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(res_id);
303 301
304 if (!res_image_skia) 302 if (!res_image_skia)
305 return PP_ERROR_FAILED; 303 return PP_ERROR_FAILED;
306 304
307 gfx::ImageSkiaRep image_skia_rep = res_image_skia->GetRepresentation( 305 gfx::ImageSkiaRep image_skia_rep = res_image_skia->GetRepresentation(scale);
308 scale_factor);
309 306
310 if (image_skia_rep.is_null() || image_skia_rep.scale_factor() != scale_factor) 307 if (image_skia_rep.is_null() || image_skia_rep.scale() != scale)
311 return PP_ERROR_FAILED; 308 return PP_ERROR_FAILED;
312 309
313 PP_Size pp_size; 310 PP_Size pp_size;
314 pp_size.width = image_skia_rep.pixel_width(); 311 pp_size.width = image_skia_rep.pixel_width();
315 pp_size.height = image_skia_rep.pixel_height(); 312 pp_size.height = image_skia_rep.pixel_height();
316 313
317 ppapi::HostResource host_resource; 314 ppapi::HostResource host_resource;
318 PP_ImageDataDesc image_data_desc; 315 PP_ImageDataDesc image_data_desc;
319 IPC::PlatformFileForTransit image_handle; 316 IPC::PlatformFileForTransit image_handle;
320 uint32_t byte_count = 0; 317 uint32_t byte_count = 0;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 bitmap->getSize(), 391 bitmap->getSize(),
395 bitmap->rowBytes()); 392 bitmap->rowBytes());
396 393
397 if (needs_unmapping) 394 if (needs_unmapping)
398 image_data->Unmap(); 395 image_data->Unmap();
399 396
400 return true; 397 return true;
401 } 398 }
402 399
403 } // namespace chrome 400 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698