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>
This commit is contained in:
Mike Reed 2018-04-04 15:39:46 -04:00 committed by Skia Commit-Bot
parent cab7d0c118
commit 1fda0247a7
10 changed files with 67 additions and 203 deletions

View File

@ -1,150 +0,0 @@
#Topic IPoint16
#Alias IPoint16_Reference
#Subtopic Overview
#Subtopic Subtopic
#Populate
##
##
#Struct SkIPoint16
SkIPoint16 holds two 16 bit integer coordinates.
#Subtopic Related_Function
#Populate
##
#Subtopic Member_Function
#Populate
##
#Subtopic Member
#Populate
#Member int16_t fX
#Line # x-axis value ##
x-axis value used by IPoint16
##
#Member int16_t fY
#Line # y-axis value ##
y-axis value used by IPoint16
##
#Subtopic Member ##
# ------------------------------------------------------------------------------
#Subtopic Constructor
#Populate
##
#Method static constexpr SkIPoint16 Make(int x, int y)
#In Constructor
#Line # constructs from integer inputs ##
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 IPoint ##
#Param y integer y-axis value of constructed IPoint ##
#Return IPoint16 (x, y) ##
#Example
SkIPoint16 pt1 = {45, 66};
SkIPoint16 pt2 = SkIPoint16::Make(45, 66);
SkDebugf("pt1.fX %c= pt2.fX\n", pt1.fX == pt2.fX ? '=' : '!');
SkDebugf("pt1.fY %c= pt2.fY\n", pt1.fY == pt2.fY ? '=' : '!');
#StdOut
pt1.fX == pt2.fX
pt1.fY == pt2.fY
##
##
#SeeAlso set() SkPoint::iset() SkIPoint::Make
#Method ##
# ------------------------------------------------------------------------------
#Subtopic Property
#Line # member values ##
#Populate
##
#Method int16_t x() const
#In Property
#Line # returns fX ##
Returns x-axis value of IPoint16.
#Return fX ##
#Example
SkIPoint16 pt1 = {45, 66};
SkDebugf("pt1.fX %c= pt1.x()\n", pt1.fX == pt1.x() ? '=' : '!');
#StdOut
pt1.fX == pt1.x()
##
##
#SeeAlso y() SkIPoint::x()
#Method ##
# ------------------------------------------------------------------------------
#Method int16_t y() const
#In Property
#Line # returns fY ##
Returns y-axis value of IPoint.
#Return fY ##
#Example
SkIPoint16 pt1 = {45, 66};
SkDebugf("pt1.fY %c= pt1.y()\n", pt1.fY == pt1.y() ? '=' : '!');
#StdOut
pt1.fY == pt1.y()
##
##
#SeeAlso x() SkPoint::y() SkIPoint::y()
#Method ##
# ------------------------------------------------------------------------------
#Subtopic Set
#Populate
#Line # replaces all values ##
##
#Method void set(int x, int y)
#In Set
#Line # sets to integer input ##
Sets fX to x and fY to y.
#Param x new value for fX ##
#Param y new value for fY ##
#Example
SkIPoint16 pt1, pt2 = { SK_MinS16, SK_MaxS16 };
pt1.set(SK_MinS16, SK_MaxS16);
SkDebugf("pt1.fX %c= pt2.fX\n", pt1.fX == pt2.fX ? '=' : '!');
SkDebugf("pt1.fY %c= pt2.fY\n", pt1.fY == pt2.fY ? '=' : '!');
#StdOut
pt1.fX == pt2.fX
pt1.fY == pt2.fY
##
##
#SeeAlso Make SkPoint::set
#Method ##
#Struct SkIPoint16 ##
#Topic IPoint16 ##

View File

@ -61,7 +61,7 @@ pt1 == pt2
##
##
#SeeAlso set() SkPoint::iset() SkPoint::Make SkIPoint16::Make
#SeeAlso set() SkPoint::iset() SkPoint::Make
#Method ##
@ -87,7 +87,7 @@ pt1.fX == pt1.x()
##
##
#SeeAlso y() SkPoint::x() SkIPoint16::x()
#SeeAlso y() SkPoint::x()
#Method ##
@ -108,7 +108,7 @@ pt1.fY == pt1.y()
##
##
#SeeAlso x() SkPoint::y() SkIPoint16::y()
#SeeAlso x() SkPoint::y()
#Method ##
@ -157,7 +157,7 @@ pt1 == pt2
##
##
#SeeAlso Make SkIPoint16::set
#SeeAlso Make
#Method ##

View File

@ -18,7 +18,6 @@
"docs": [
"SkAutoCanvasRestore_Reference.bmh",
"SkCanvas_Reference.bmh",
"SkIPoint16_Reference.bmh",
"SkPaint_Reference.bmh",
"SkPoint_Reference.bmh",
"SkIRect_Reference.bmh",

View File

@ -30,7 +30,8 @@ public:
/** Color, same value for all four corners of a glyph quad. */
uint32_t fColor;
/** Texture coordinate (in texel units, not normalized). */
SkIPoint16 fTextureCoord;
int16_t fTextureCoordX;
int16_t fTextureCoordY;
};
virtual ~SkAtlasTextRenderer() = default;

View File

@ -12,48 +12,6 @@
#include "SkScalar.h"
#include "../private/SkSafe32.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);
}
};
struct SkIPoint;
typedef SkIPoint SkIVector;

View File

@ -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,

56
src/core/SkIPoint16.h Normal file
View File

@ -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

View File

@ -8,7 +8,7 @@
#ifndef GrDrawOpAtlas_DEFINED
#define GrDrawOpAtlas_DEFINED
#include "SkPoint.h"
#include "SkIPoint16.h"
#include "SkTDArray.h"
#include "SkTInternalLList.h"

View File

@ -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

View File

@ -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() ||