diff options
author | Mike Reed <reed@google.com> | 2018-04-04 15:39:46 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-04 20:16:58 +0000 |
commit | 1fda0247a77e5c7af57163750a3f7a04fddffdd5 (patch) | |
tree | f809560fa1f70bd5d6fc037154e763d9fdf5720e /src | |
parent | cab7d0c118005221691f745df78dc46168e682e1 (diff) |
move SkIPoint16 to private header
Bug: skia:
Change-Id: Ib8045ac7cc24a44c4b70e73153c6faf098730b63
Reviewed-on: https://skia-review.googlesource.com/118721
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/atlastext/SkInternalAtlasTextContext.cpp | 4 | ||||
-rw-r--r-- | src/core/SkIPoint16.h | 56 | ||||
-rw-r--r-- | src/gpu/GrDrawOpAtlas.h | 2 | ||||
-rw-r--r-- | src/gpu/GrRectanizer_pow2.h | 2 | ||||
-rw-r--r-- | src/gpu/GrRectanizer_skyline.cpp | 2 |
5 files changed, 61 insertions, 5 deletions
diff --git a/src/atlastext/SkInternalAtlasTextContext.cpp b/src/atlastext/SkInternalAtlasTextContext.cpp index 0ff4f3e5d3..8abe2e8f9e 100644 --- a/src/atlastext/SkInternalAtlasTextContext.cpp +++ b/src/atlastext/SkInternalAtlasTextContext.cpp @@ -79,8 +79,8 @@ void SkInternalAtlasTextContext::recordDraw(const void* srcVertexData, int glyph auto* vertex = reinterpret_cast<SkAtlasTextRenderer::SDFVertex*>(vertexData) + i; // GrAtlasTextContext encodes a texture index into the lower bit of each texture coord. // This isn't expected by SkAtlasTextRenderer subclasses. - vertex->fTextureCoord.fX /= 2; - vertex->fTextureCoord.fY /= 2; + vertex->fTextureCoordX /= 2; + vertex->fTextureCoordY /= 2; matrix.mapHomogeneousPoints(&vertex->fPosition, &vertex->fPosition, 1); } fDraws.append(&fArena, diff --git a/src/core/SkIPoint16.h b/src/core/SkIPoint16.h new file mode 100644 index 0000000000..27052b3f2a --- /dev/null +++ b/src/core/SkIPoint16.h @@ -0,0 +1,56 @@ +/* + * Copyright 2018 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkIPoint16_DEFINED +#define SkIPoint16_DEFINED + +#include "SkTypes.h" + +/** \struct SkIPoint16 + SkIPoint16 holds two 16 bit integer coordinates. + */ +struct SkIPoint16 { + int16_t fX; //!< x-axis value used by SkIPoint16 + + int16_t fY; //!< y-axis value used by SkIPoint16 + + /** Sets fX to x, fY to y. If SK_DEBUG is defined, asserts + if x or y does not fit in 16 bits. + + @param x integer x-axis value of constructed SkIPoint + @param y integer y-axis value of constructed SkIPoint + @return SkIPoint16 (x, y) + */ + static constexpr SkIPoint16 Make(int x, int y) { + return {SkToS16(x), SkToS16(y)}; + } + + /** Returns x-axis value of SkIPoint16. + + @return fX + */ + int16_t x() const { return fX; } + + /** Returns y-axis value of SkIPoint. + + @return fY + */ + int16_t y() const { return fY; } + + /** Sets fX to x and fY to y. + + @param x new value for fX + @param y new value for fY + */ + void set(int x, int y) { + fX = SkToS16(x); + fY = SkToS16(y); + } +}; + +#endif + diff --git a/src/gpu/GrDrawOpAtlas.h b/src/gpu/GrDrawOpAtlas.h index 6106c0c64b..4369794025 100644 --- a/src/gpu/GrDrawOpAtlas.h +++ b/src/gpu/GrDrawOpAtlas.h @@ -8,7 +8,7 @@ #ifndef GrDrawOpAtlas_DEFINED #define GrDrawOpAtlas_DEFINED -#include "SkPoint.h" +#include "SkIPoint16.h" #include "SkTDArray.h" #include "SkTInternalLList.h" diff --git a/src/gpu/GrRectanizer_pow2.h b/src/gpu/GrRectanizer_pow2.h index 902895e820..3c3928ed85 100644 --- a/src/gpu/GrRectanizer_pow2.h +++ b/src/gpu/GrRectanizer_pow2.h @@ -11,7 +11,7 @@ #include "GrRectanizer.h" #include "SkMathPriv.h" #include "SkMalloc.h" -#include "SkPoint.h" +#include "SkIPoint16.h" // This Rectanizer quantizes the incoming rects to powers of 2. Each power // of two can have, at most, one active row/shelf. Once a row/shelf for diff --git a/src/gpu/GrRectanizer_skyline.cpp b/src/gpu/GrRectanizer_skyline.cpp index c4d26e026d..44ef8134fa 100644 --- a/src/gpu/GrRectanizer_skyline.cpp +++ b/src/gpu/GrRectanizer_skyline.cpp @@ -6,7 +6,7 @@ */ #include "GrRectanizer_skyline.h" -#include "SkPoint.h" +#include "SkIPoint16.h" bool GrRectanizerSkyline::addRect(int width, int height, SkIPoint16* loc) { if ((unsigned)width > (unsigned)this->width() || |