Skip to content

Commit

Permalink
Roll src/third_party/skia b5fae93:c13bc57 (manual roll)
Browse files Browse the repository at this point in the history
Summary of changes available at:
https://chromium.googlesource.com/skia/+log/b5fae93..c13bc57

This roll includes SkDevice::drawPosText API changes for GatherPixelRefDevice and VectorPlatformDeviceEmf, needed after https://codereview.chromium.org/605533002.

CQ_EXTRA_TRYBOTS=tryserver.blink:linux_blink_rel,linux_blink_dbg
TBR=robertphillips@google.com

Review URL: https://codereview.chromium.org/607853003

Cr-Commit-Position: refs/heads/master@{#297168}
  • Loading branch information
fmalita authored and Commit bot committed Sep 29, 2014
1 parent 59379b0 commit 7a643ed
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ vars = {
'boringssl_git': 'https://boringssl.googlesource.com',
'libvpx_revision': 'efe9712d52c2d216fb3d1ceb508b8148847a7e4b',
'sfntly_revision': '1bdaae8fc788a5ac8936d68bf24f37d977a13dac',
'skia_revision': 'b5fae93d72c7b6480f83fd8a7b534cd1fdfcd49a',
'skia_revision': 'c13bc571d3e61a43b87eb97f0719abd304cafaf2',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling Skia
# and V8 without interference from each other.
Expand Down
20 changes: 6 additions & 14 deletions skia/ext/pixel_ref_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ class GatherPixelRefDevice : public SkBitmapDevice {
const void* text,
size_t len,
const SkScalar pos[],
SkScalar const_y,
int scalars_per_pos,
const SkPoint& offset,
const SkPaint& paint) SK_OVERRIDE {
SkBitmap bitmap;
if (!GetBitmapFromPaint(paint, &bitmap))
Expand All @@ -235,21 +235,13 @@ class GatherPixelRefDevice : public SkBitmapDevice {
// Similar to SkDraw asserts.
SkASSERT(scalars_per_pos == 1 || scalars_per_pos == 2);

SkPoint min_point;
SkPoint max_point;
if (scalars_per_pos == 1) {
min_point.set(pos[0], const_y);
max_point.set(pos[0], const_y);
} else if (scalars_per_pos == 2) {
min_point.set(pos[0], const_y + pos[1]);
max_point.set(pos[0], const_y + pos[1]);
}
SkPoint min_point = SkPoint::Make(offset.x() + pos[0],
offset.y() + (2 == scalars_per_pos ? pos[1] : 0));
SkPoint max_point = min_point;

for (size_t i = 0; i < len; ++i) {
SkScalar x = pos[i * scalars_per_pos];
SkScalar y = const_y;
if (scalars_per_pos == 2)
y += pos[i * scalars_per_pos + 1];
SkScalar x = offset.x() + pos[i * scalars_per_pos];
SkScalar y = offset.y() + (2 == scalars_per_pos ? pos[i * scalars_per_pos + 1] : 0);

min_point.set(std::min(x, min_point.x()), std::min(y, min_point.y()));
max_point.set(std::max(x, max_point.x()), std::max(y, max_point.y()));
Expand Down
12 changes: 7 additions & 5 deletions skia/ext/vector_platform_device_emf_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,17 @@ void VectorPlatformDeviceEmf::drawPosText(const SkDraw& draw,
const void* text,
size_t len,
const SkScalar pos[],
SkScalar constY,
int scalarsPerPos,
const SkPoint& offset,
const SkPaint& paint) {
SkGDIFontSetup setup;
bool useDrawText = true;

if (scalarsPerPos == 2 && len >= 2 &&
SkPaint::kUTF8_TextEncoding != paint.getTextEncoding() &&
setup.useGDI(hdc_, paint)) {
int startX = SkScalarRoundToInt(pos[0]);
int startY = SkScalarRoundToInt(pos[1] + getAscent(paint));
int startX = SkScalarRoundToInt(pos[0] + offset.x());
int startY = SkScalarRoundToInt(pos[1] + offset.y() + getAscent(paint));
const int count = len >> 1;
SkAutoSTMalloc<64, INT> storage(count);
INT* advances = storage.get();
Expand Down Expand Up @@ -552,9 +552,11 @@ void VectorPlatformDeviceEmf::drawPosText(const SkDraw& draw,
const char* curr = reinterpret_cast<const char*>(text);
const char* stop = curr + len;
while (curr < stop) {
SkScalar y = (1 == scalarsPerPos) ? constY : pos[1];
SkScalar x = offset.x() + pos[0];
SkScalar y = offset.y() + (2 == scalarsPerPos ? pos[1] : 0);

size_t bytes = bytesPerCodePoint(curr);
drawText(draw, curr, bytes, pos[0], y, paint);
drawText(draw, curr, bytes, x, y, paint);
curr += bytes;
pos += scalarsPerPos;
}
Expand Down
4 changes: 2 additions & 2 deletions skia/ext/vector_platform_device_emf_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class VectorPlatformDeviceEmf : public SkBitmapDevice, public PlatformDevice {
virtual void drawText(const SkDraw& draw, const void* text, size_t len,
SkScalar x, SkScalar y, const SkPaint& paint) OVERRIDE;
virtual void drawPosText(const SkDraw& draw, const void* text, size_t len,
const SkScalar pos[], SkScalar constY,
int scalarsPerPos, const SkPaint& paint) OVERRIDE;
const SkScalar pos[], int scalarsPerPos,
const SkPoint& offset, const SkPaint& paint) OVERRIDE;
virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint) OVERRIDE;
Expand Down

0 comments on commit 7a643ed

Please sign in to comment.