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

Side by Side Diff: content/child/browser_font_resource_trusted.cc

Issue 2618373002: Remove PPB_ImageData_API::GetPlatformCanvas() (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('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 "content/child/browser_font_resource_trusted.h" 5 #include "content/child/browser_font_resource_trusted.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 const PP_Rect* clip, 308 const PP_Rect* clip,
309 PP_Bool image_data_is_opaque) { 309 PP_Bool image_data_is_opaque) {
310 PP_Bool result = PP_FALSE; 310 PP_Bool result = PP_FALSE;
311 // Get and map the image data we're painting to. 311 // Get and map the image data we're painting to.
312 EnterResourceNoLock<PPB_ImageData_API> enter(image_data, true); 312 EnterResourceNoLock<PPB_ImageData_API> enter(image_data, true);
313 if (enter.failed()) 313 if (enter.failed())
314 return result; 314 return result;
315 315
316 PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>( 316 PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(
317 enter.object()); 317 enter.object());
318 SkCanvas* canvas = image->GetPlatformCanvas(); 318 SkCanvas* canvas = image->GetCanvas();
319 bool needs_unmapping = false; 319 bool needs_unmapping = false;
320 if (!canvas) { 320 if (!canvas) {
321 needs_unmapping = true; 321 needs_unmapping = true;
322 image->Map(); 322 image->Map();
323 canvas = image->GetPlatformCanvas(); 323 canvas = image->GetCanvas();
324 if (!canvas) 324 if (!canvas)
325 return result; // Failure mapping. 325 return result; // Failure mapping.
326 } 326 }
327 327
328 if (!PP_ToBool(image_data_is_opaque)) { 328 if (!PP_ToBool(image_data_is_opaque)) {
329 // Ideally, LCD text should be configured at canvas creation time using 329 // Ideally, LCD text should be configured at canvas creation time using
330 // SkSurfaceProps. But because the API exposes image_data_is_opaque per 330 // SkSurfaceProps. But because the API exposes image_data_is_opaque per
331 // draw text call (allowing clients to essentially change their mind), 331 // draw text call (allowing clients to essentially change their mind),
332 // we have to handle it here. 332 // we have to handle it here.
333 SkImageInfo info; 333 SkImageInfo info;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 444
445 // Advance to the next run. Note that we avoid doing this for the last run 445 // Advance to the next run. Note that we avoid doing this for the last run
446 // since it's unnecessary, measuring text is slow, and most of the time 446 // since it's unnecessary, measuring text is slow, and most of the time
447 // there will be only one run anyway. 447 // there will be only one run anyway.
448 if (i != runs.num_runs() - 1) 448 if (i != runs.num_runs() - 1)
449 web_position.x += font_->calculateWidth(run); 449 web_position.x += font_->calculateWidth(run);
450 } 450 }
451 } 451 }
452 452
453 } // namespace content 453 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698