Commit 8d0a42f1 authored by Dominik Röttsches's avatar Dominik Röttsches Committed by Commit Bot

Merge BlobRotation and CanvasRotationInVertical

Bug: 788725
Change-Id: I09d62b7df3f739006972a27f35ab26da4808e310
Reviewed-on: https://chromium-review.googlesource.com/807933Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521698}
parent 9a9083e4
......@@ -114,8 +114,7 @@ void DrawBlobs(PaintCanvas* canvas,
for (const auto& blob_info : blobs) {
DCHECK(blob_info.blob);
PaintCanvasAutoRestore auto_restore(canvas, false);
if (blob_info.rotation ==
ShapeResultBloberizer::BlobRotation::kCCWRotation) {
if (blob_info.rotation == CanvasRotationInVertical::kRotateCanvasUpright) {
canvas->save();
SkMatrix m;
......@@ -289,7 +288,7 @@ unsigned InterceptsFromBlobs(const ShapeResultBloberizer::BlobBuffer& blobs,
// for a change in font. A TextBlob can contain runs with differing fonts
// and the getTextBlobIntercepts method handles multiple fonts for us. For
// upright in vertical blobs we currently have to bail, see crbug.com/655154
if (blob_info.rotation == ShapeResultBloberizer::BlobRotation::kCCWRotation)
if (blob_info.rotation == CanvasRotationInVertical::kRotateCanvasUpright)
continue;
SkScalar* offset_intercepts_buffer = nullptr;
......
......@@ -32,12 +32,11 @@ void ShapeResultBloberizer::CommitPendingRun() {
if (pending_glyphs_.IsEmpty())
return;
const auto pending_rotation = GetBlobRotation(pending_canvas_rotation_);
if (pending_rotation != builder_rotation_) {
if (pending_canvas_rotation_ != builder_rotation_) {
// The pending run rotation doesn't match the current blob; start a new
// blob.
CommitPendingBlob();
builder_rotation_ = pending_rotation;
builder_rotation_ = pending_canvas_rotation_;
}
PaintFont run_font;
......@@ -75,15 +74,6 @@ const ShapeResultBloberizer::BlobBuffer& ShapeResultBloberizer::Blobs() {
return blobs_;
}
// TODO(drott) crbug.com/788725: Try to merge BlobRotation and
// CanvasRotationInVertical.
ShapeResultBloberizer::BlobRotation ShapeResultBloberizer::GetBlobRotation(
const CanvasRotationInVertical canvas_rotation) {
return canvas_rotation == CanvasRotationInVertical::kRegular
? BlobRotation::kNoRotation
: BlobRotation::kCCWRotation;
}
float ShapeResultBloberizer::FillGlyphs(
const TextRunPaintInfo& run_info,
const ShapeResultBuffer& result_buffer) {
......
......@@ -6,6 +6,7 @@
#define ShapeResultBloberizer_h
#include "platform/PlatformExport.h"
#include "platform/fonts/CanvasRotationInVertical.h"
#include "platform/fonts/Glyph.h"
#include "platform/fonts/SimpleFontData.h"
#include "platform/fonts/shaping/ShapeResultBuffer.h"
......@@ -60,7 +61,7 @@ class PLATFORM_EXPORT ShapeResultBloberizer {
CommitPendingRun();
pending_font_data_ = font_data;
pending_canvas_rotation_ = canvas_rotation;
DCHECK_EQ(GetBlobRotation(canvas_rotation), BlobRotation::kNoRotation);
DCHECK_EQ(canvas_rotation, CanvasRotationInVertical::kRegular);
}
pending_glyphs_.push_back(glyph);
......@@ -80,7 +81,7 @@ class PLATFORM_EXPORT ShapeResultBloberizer {
pending_font_data_ = font_data;
pending_canvas_rotation_ = canvas_rotation;
pending_vertical_baseline_x_offset_ =
GetBlobRotation(canvas_rotation) == BlobRotation::kNoRotation
canvas_rotation == CanvasRotationInVertical::kRegular
? 0
: font_data->GetFontMetrics().FloatAscent() -
font_data->GetFontMetrics().FloatAscent(
......@@ -93,12 +94,11 @@ class PLATFORM_EXPORT ShapeResultBloberizer {
pending_offsets_.push_back(offset.Y());
}
enum class BlobRotation { kNoRotation, kCCWRotation };
struct BlobInfo {
BlobInfo(scoped_refptr<PaintTextBlob> b, BlobRotation r)
BlobInfo(scoped_refptr<PaintTextBlob> b, CanvasRotationInVertical r)
: blob(std::move(b)), rotation(r) {}
scoped_refptr<PaintTextBlob> blob;
BlobRotation rotation;
CanvasRotationInVertical rotation;
};
using BlobBuffer = Vector<BlobInfo, 16>;
......@@ -142,7 +142,6 @@ class PLATFORM_EXPORT ShapeResultBloberizer {
void CommitPendingBlob();
bool HasPendingVerticalOffsets() const;
static BlobRotation GetBlobRotation(const CanvasRotationInVertical);
const Font& font_;
const float device_scale_factor_;
......@@ -150,7 +149,8 @@ class PLATFORM_EXPORT ShapeResultBloberizer {
// Current text blob state.
PaintTextBlobBuilder builder_;
BlobRotation builder_rotation_ = BlobRotation::kNoRotation;
CanvasRotationInVertical builder_rotation_ =
CanvasRotationInVertical::kRegular;
size_t builder_run_count_ = 0;
// Current run state.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment