In Vakil's Foundations of Algebraic Geometry (see p. 385) he defines the sheaf $\mathcal{O}(m)$ on $\mathbb{P}^n$ to be equal to $\mathcal{O}$ on affine sets $U_i = $Spec $k[x_{0/i}, x_{1/i}, \dots, x_{n/i}]$ (his notation; this is the open subset of Proj $k[x_0, \dots, x_n]$ with $x_i \neq 0$) with transition functions $T_{ij}$ from $U_i$ to $U_j$ given by multiplication by $(x_{i/j})^m$.
This definition is pretty clear to me. In particular, giving a section of $U_i$ is the same as giving a polynomial in the $x_j/x_i$, which is to say a polynomial in the $x_j/x_i$. This is the same as giving an element of $k[x_0, \dots,x_n]$ localized at $(x_i)$ such that the degree of the numerator and denominator is the same. The difference between $\mathcal{O}(m)$ and $\mathcal{O}$ appears in their global structure which we see in the transition functions.
In Hartshorne's book he defines the same sheaf as follows (chapter II section 5). Let $S = k[x_0, \dots, x_n]$ and let $S(m)$ be $S$ with the grading twisted by $m$. Then $\mathcal{O}(m)$ is the sheaf on Proj $S$ associated to $S(m)$, which on open sets $U$ is given by the set of functions $U \to \coprod_{p\in U} S(m)_{(p)}$ that are locally fractions, where $S(m)_{(p)}$ is the localization of $S(m)$ at the set of homogeneous elements of $S$ not in $p$.
By my reading of this definition, a section of $U_i$ is then a rational function $f/x_i^r$ where the degree of $f$ (as a polynomial) is $r+m$. This contradicts my understanding from Vakil's definition. What have I missed?