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

Side by Side Diff: chrome/renderer/webplugin_delegate_pepper.cc

Issue 3968001: Update code that previously constructed strings from string iterators only to... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #define PEPPER_APIS_ENABLED 1 5 #define PEPPER_APIS_ENABLED 1
6 6
7 #include "chrome/renderer/webplugin_delegate_pepper.h" 7 #include "chrome/renderer/webplugin_delegate_pepper.h"
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 static const int kBytesPixel = 4; 607 static const int kBytesPixel = 4;
608 int32 row_count = context->dirty.bottom - context->dirty.top; 608 int32 row_count = context->dirty.bottom - context->dirty.top;
609 int32 stride = context->dirty.right - context->dirty.left; 609 int32 stride = context->dirty.right - context->dirty.left;
610 size_t length = row_count * stride * kBytesPixel; 610 size_t length = row_count * stride * kBytesPixel;
611 MD5Digest md5_result; // 128-bit digest 611 MD5Digest md5_result; // 128-bit digest
612 MD5Sum(context->region, length, &md5_result); 612 MD5Sum(context->region, length, &md5_result);
613 std::string hex_md5 = MD5DigestToBase16(md5_result); 613 std::string hex_md5 = MD5DigestToBase16(md5_result);
614 // Return the least significant 8 characters (i.e. 4 bytes) 614 // Return the least significant 8 characters (i.e. 4 bytes)
615 // of the 32 character hexadecimal result as an int. 615 // of the 32 character hexadecimal result as an int.
616 int int_val; 616 int int_val;
617 base::HexStringToInt(hex_md5.substr(24), &int_val); 617 DCHECK_EQ(hex_md5.length(), 32u);
618 base::HexStringToInt(hex_md5.begin() + 24, hex_md5.end(), &int_val);
618 *value = int_val; 619 *value = int_val;
619 return NPERR_NO_ERROR; 620 return NPERR_NO_ERROR;
620 } 621 }
621 return NPERR_GENERIC_ERROR; 622 return NPERR_GENERIC_ERROR;
622 } 623 }
623 624
624 NPError WebPluginDelegatePepper::Device2DFlushContext( 625 NPError WebPluginDelegatePepper::Device2DFlushContext(
625 NPP id, 626 NPP id,
626 NPDeviceContext2D* context, 627 NPDeviceContext2D* context,
627 NPDeviceFlushContextCallbackPtr callback, 628 NPDeviceFlushContextCallbackPtr callback,
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 CGRect bounds; 1760 CGRect bounds;
1760 bounds.origin.x = dest_rect.x(); 1761 bounds.origin.x = dest_rect.x();
1761 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height(); 1762 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height();
1762 bounds.size.width = dest_rect.width(); 1763 bounds.size.width = dest_rect.width();
1763 bounds.size.height = dest_rect.height(); 1764 bounds.size.height = dest_rect.height();
1764 1765
1765 CGContextDrawImage(canvas, bounds, image); 1766 CGContextDrawImage(canvas, bounds, image);
1766 CGContextRestoreGState(canvas); 1767 CGContextRestoreGState(canvas);
1767 } 1768 }
1768 #endif // defined(OS_MACOSX) 1769 #endif // defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698