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

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

Issue 1611011: fixing bug in 2D context painted area pixel count computation ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 8 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 | « no previous file | no next file » | 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) 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 "build/build_config.h" 7 #include "build/build_config.h"
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 #endif 10 #endif
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 return NPERR_INVALID_PARAM; 473 return NPERR_INVALID_PARAM;
474 Graphics2DDeviceContext* ctx = graphic2d_contexts_.Lookup( 474 Graphics2DDeviceContext* ctx = graphic2d_contexts_.Lookup(
475 reinterpret_cast<intptr_t>(context->reserved)); 475 reinterpret_cast<intptr_t>(context->reserved));
476 if (!ctx) 476 if (!ctx)
477 return NPERR_INVALID_PARAM; 477 return NPERR_INVALID_PARAM;
478 *value = reinterpret_cast<intptr_t>(ctx->transport_dib()); 478 *value = reinterpret_cast<intptr_t>(ctx->transport_dib());
479 return NPERR_NO_ERROR; 479 return NPERR_NO_ERROR;
480 } else if (state == NPExtensionsReservedStateSharedMemoryChecksum) { 480 } else if (state == NPExtensionsReservedStateSharedMemoryChecksum) {
481 if (!context) 481 if (!context)
482 return NPERR_INVALID_PARAM; 482 return NPERR_INVALID_PARAM;
483 int32 row_count = context->dirty.bottom - context->dirty.top + 1; 483 // Bytes per pixel.
484 int32 stride = context->dirty.right - context->dirty.left + 1; 484 static const int kBytesPixel = 4;
485 size_t length = row_count * stride * sizeof(uint32); 485 int32 row_count = context->dirty.bottom - context->dirty.top;
486 int32 stride = context->dirty.right - context->dirty.left;
487 size_t length = row_count * stride * kBytesPixel;
486 MD5Digest md5_result; // 128-bit digest 488 MD5Digest md5_result; // 128-bit digest
487 MD5Sum(context->region, length, &md5_result); 489 MD5Sum(context->region, length, &md5_result);
488 std::string hex_md5 = MD5DigestToBase16(md5_result); 490 std::string hex_md5 = MD5DigestToBase16(md5_result);
489 // Return the least significant 8 characters (i.e. 4 bytes) 491 // Return the least significant 8 characters (i.e. 4 bytes)
490 // of the 32 character hexadecimal result as an int. 492 // of the 32 character hexadecimal result as an int.
491 *value = HexStringToInt(hex_md5.substr(24)); 493 *value = HexStringToInt(hex_md5.substr(24));
492 return NPERR_NO_ERROR; 494 return NPERR_NO_ERROR;
493 } 495 }
494 return NPERR_GENERIC_ERROR; 496 return NPERR_GENERIC_ERROR;
495 } 497 }
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 StretchDIBits(dc, printable_area.x(), printable_area.y(), 1458 StretchDIBits(dc, printable_area.x(), printable_area.y(),
1457 printable_area.width(), printable_area.height(), 1459 printable_area.width(), printable_area.height(),
1458 0, 0, bitmap.width(), bitmap.height(), 1460 0, 0, bitmap.width(), bitmap.height(),
1459 &compressed_image.front(), 1461 &compressed_image.front(),
1460 reinterpret_cast<const BITMAPINFO*>(&bmi), 1462 reinterpret_cast<const BITMAPINFO*>(&bmi),
1461 DIB_RGB_COLORS, SRCCOPY); 1463 DIB_RGB_COLORS, SRCCOPY);
1462 return true; 1464 return true;
1463 } 1465 }
1464 #endif // OS_WIN 1466 #endif // OS_WIN
1465 1467
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698