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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp

Issue 1779833002: Switch Blink SkShader clients to sk_sp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after MakePictureShader constness change Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 SkScalar originX = WebCoreFloatToSkScalar(pt.x()); 628 SkScalar originX = WebCoreFloatToSkScalar(pt.x());
629 629
630 // Offset it vertically by 1 so that there's some space under the text. 630 // Offset it vertically by 1 so that there's some space under the text.
631 SkScalar originY = WebCoreFloatToSkScalar(pt.y()) + 1; 631 SkScalar originY = WebCoreFloatToSkScalar(pt.y()) + 1;
632 originX *= deviceScaleFactor; 632 originX *= deviceScaleFactor;
633 originY *= deviceScaleFactor; 633 originY *= deviceScaleFactor;
634 #endif 634 #endif
635 635
636 SkMatrix localMatrix; 636 SkMatrix localMatrix;
637 localMatrix.setTranslate(originX, originY); 637 localMatrix.setTranslate(originX, originY);
638 RefPtr<SkShader> shader = adoptRef(SkShader::CreateBitmapShader(
639 *misspellBitmap[index], SkShader::kRepeat_TileMode, SkShader::kRepeat_Ti leMode, &localMatrix));
640 638
641 SkPaint paint; 639 SkPaint paint;
642 paint.setShader(shader.get()); 640 paint.setShader(SkShader::MakeBitmapShader(*misspellBitmap[index],
641 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &localMatrix));
643 642
644 SkRect rect; 643 SkRect rect;
645 rect.set(originX, originY, originX + WebCoreFloatToSkScalar(width) * deviceS caleFactor, originY + SkIntToScalar(misspellBitmap[index]->height())); 644 rect.set(originX, originY, originX + WebCoreFloatToSkScalar(width) * deviceS caleFactor, originY + SkIntToScalar(misspellBitmap[index]->height()));
646 645
647 if (deviceScaleFactor == 2) { 646 if (deviceScaleFactor == 2) {
648 save(); 647 save();
649 scale(0.5, 0.5); 648 scale(0.5, 0.5);
650 } 649 }
651 drawRect(rect, paint); 650 drawRect(rect, paint);
652 if (deviceScaleFactor == 2) 651 if (deviceScaleFactor == 2)
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 static const SkPMColor colors[] = { 1359 static const SkPMColor colors[] = {
1361 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red 1360 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red
1362 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray 1361 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray
1363 }; 1362 };
1364 1363
1365 return colors[index]; 1364 return colors[index];
1366 } 1365 }
1367 #endif 1366 #endif
1368 1367
1369 } // namespace blink 1368 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Gradient.cpp ('k') | third_party/WebKit/Source/platform/graphics/Image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698